함수형프로그래밍

· Frontend/JS
const product = [ { name: '반팔티', price: 15000, quantity: 1 }, { name: '긴팔티', price: 20000, quantity: 2 }, { name: '핸드폰케이스', price; 15000, quantity: 3 }, { name: '후드티', price: 30000, quantity: 4 }, { name: '바지', price: 25000, quantity: 5 }, ]; const go = (...args) => reduce((a, f) => f(a), args); 여기서 수량을 모두 합하고자 할 때, go를 통해 연속적으로 함수를 실행할 수 있다. go( products, map(p => p.quantity), console.log ); 위의..
턴태
'함수형프로그래밍' 태그의 글 목록