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"]}

 

 

https://harrythegreat.tistory.com/entry/%EC%96%B8%EB%8D%94%EC%8A%A4%EC%BD%94%EC%96%B4-%EC%A0%95%EB%A6%AC

 

javascript underscore 언더스코어 정리

언더스코어란? 용어설명 Context iteratee Context와 iteratee의 구분 Collection Functions (Arrays or Objects) each map reduce reduceRight find filter where findWhere reject every some contains invoke p..

harrythegreat.tistory.com

 

728x90

'Javascript underscore' 카테고리의 다른 글

0209 연습  (0) 2022.02.09
[underscore] 언더스코어 정리  (0) 2021.12.06

+ Recent posts