Just Enough Functional Programming In JavaScript 정보
기타 Just Enough Functional Programming In JavaScript본문
const withCount = fn => {
let count = 0;
return (...args) => {
console.log(`Call coun: ${++count}`)
return fn(...args)
}
}
const add = (x, y) => x + y
const countedAdd = withCount(add)
console.log(countedAdd(1, 2))
console.log(countedAdd(2, 2))
console.log(countedAdd(3, 2))
정답은?
추천
0
0
댓글 0개