728x90
리턴값이 같은것 끼리 array로 묶는다.
//_.groupBy(list, iteratee, [context])
_.groupBy([1.3, 2.1, 2.4], function(num){ return Math.floor(num); });
=> {1: [1.3], 2: [2.1, 2.4]}
_.groupBy(['one', 'two', 'three'], 'length');
=> {3: ["one", "two"], 5: ["three"]}
728x90
'Javascript underscore' 카테고리의 다른 글
0209 연습 (0) | 2022.02.09 |
---|---|
[underscore] 언더스코어 정리 (0) | 2021.12.06 |