标签:back var call rate sso ons ack iss 返回
1.map
function timesThree(n) {
return n * 3;
}
_.map([1, 2], timesThree);
// => [3, 6]
2.remove
移除数组 array 中满足 predicate 条件的所有元素 ,返回的是被移除元素数组.
var array = [1, 2, 3, 4];
var evens = _.remove(array, function(n) {
return n % 2 == 0;
});
console.log(array);
// => [1, 3]
console.log(evens);
// => [2, 4]
3.uniq
唯一
_.uniq([2, 1, 2]);
// => [2, 1]
// using `isSorted`
_.uniq([1, 1, 2], true);
// => [1, 2]
// using an iteratee function
_.uniq([1, 2.5, 1.5, 2], function(n) {
return this.floor(n);
}, Math);
// => [1, 2.5]
// using the `_.property` callback shorthand
_.uniq([{ ‘x‘: 1 }, { ‘x‘: 2 }, { ‘x‘: 1 }], ‘x‘);
// => [{ ‘x‘: 1 }, { ‘x‘: 2 }]
标签:back var call rate sso ons ack iss 返回
原文地址:http://www.cnblogs.com/ganchuanpu/p/6192977.html