扫码一下
查看教程更方便
_.isEqual(object, other)
isEqual() 执行两个对象之间的优化深度比较,确定他们是否应被视为相等。
var _ = require('underscore');
var student = {name: 'Sam', age: 10, class: { name: '10th', section: 'B'}}
var student1 = {name: 'Sam', age: 10, class: { name: '10th', section: 'B'}}
// 示例: 使用 == 比较 student 和 student1
console.log(student == student1);
var result = _.isEqual(student, student1);
console.log(result);
上面示例运行结果如下