![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lodash.js
山海一哥
为者常成,行者常至
展开
-
lodash数组常用方法总结
1,去假值。The values false, null, 0, “”, undefined, and NaN are falsey._.compact([0, 1, false, 2, '', 3]);// => [1, 2, 3]2,合并成新数组var array = [1];var other = _.concat(array, 2, [3], [[4]]); con...翻译 2019-02-01 14:30:09 · 3689 阅读 · 0 评论 -
lodash Collection常用方法总结
1,统计键的次数_.countBy([6.1, 4.2, 6.3], Math.floor);// => { '4': 1, '6': 2 }2,遍历数组或对象_.forEach([1, 2], function(value) { console.log(value);});// => Logs `1` then `2`. _.forEach({ 'a': 1, ...翻译 2019-02-01 15:02:45 · 608 阅读 · 0 评论