Returns true if the value is present in the list, using === to test equality. UsesindexOf internally, if list is an Array.
检测值是否在列表中出现过,如果出现返回true
1 _.include([1, 2, 3], 3); 2 => true
源码:
1 _.include = _.contains = function(obj, target) { 2 var found = false; 3 if (obj == null) return found; 4 if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; 5 found = any(obj, function(value) { 6 return value === target; 7 }); 8 return found; 9 };