- ν¨μλ₯Ό κ°μΌλ‘ λ€λ£¨λ ν¨μ
const apply1 = f => f(1);
const add2 = a => a + 2;
apply1(add2) // 3
apply1(a => a - 1) // 0
const times = (f, n) => {
let i = - 1;
while (++i < n) {
f(i);
}
}
times(log, 3);
times(a => a + 10, 3);
=> applicated programing
const addMaker = a => b => a + b; // ν¨μμ΄μ aλ₯Ό κΈ°μ΅νλ ν¨μ(ν΄λ‘μ )
const add10 = addMaker(10);
log(add10) // b => a + b (ν¨μλ₯Ό 리ν΄)
log(add10(5)) // 15