compare
优质
小牛编辑
133浏览
2023-12-01
功能
Object/Array类型对象之间的比较。
author: leeenx
version: 1.0.0
data: 2015-12-07
Official Usage
$.compare({obj1:test1,obj2:test2}
Lazy Usage
$.compare(obj1,obj2);
Example
test1={
a:1,
b:"str",
c:[1,2,3,{c1:"c1",c2:2}],
d:{
d1:1,
d2:"d2",
d3:["a","b","c"]
}
};
test2={
a:11,
b:"str",
c:[1,2,3,{c1:"c1",c2:2}],
d:{
d1:1,
d2:"d2",
d3:["a","b","c"]
}
};
alert($.compare({obj1:test1,obj2:test2})?"相等":"不相等");
参数列表
name | 类型 | 必选 | 描述 |
---|---|---|---|
obj1 | object | 必选 | 参与对比的对象一 |
obj2 | object | 必选 | 参与对比的对象二 |
DEMO
点击查看compare模块下载
直接下载comparehttp://wq.360buyimg.com/js/ho2/min/uncmd.jshttp://wq.360buyimg.com/js/ho2/min/.js
http://wq.360buyimg.com/js/ho2/min/compare.js