Performs an optimized deep comparison between the two objects, to determine if they should be considered equal.
用于比较两个对象的值是否相当,而不是内存引用位置.
1 var moe = {name : 'moe', luckyNumbers : [13, 27, 34]}; 2 var clone = {name : 'moe', luckyNumbers : [13, 27, 34]}; 3 moe == clone; 4 => false 5 _.isEqual(moe, clone); 6 => true
源码:
_.isEqual = function(a, b) { return eq(a, b, []); };