개발 일기
[Javascript] 문제 틀렸어!!!!!!!!!!!!!!!!
metdoyo
2022. 10. 4. 20:04
In the following Javascript code snippet,
the callback function cb is a function that sums the value of two numbers.
Fill in the blank so that when the function is passed into the higher order function hof,
it is then invoked so that the value returned is 8.
let cb = (n1, n2) => {return n1 + n2};
let hof = (func) => {
let value = cb(3, 5); // 여기
return `this function returned ${value}`;
}
hof(cb) // 'this function returned 8'
답은 func(3, 5)인데 지금 이해가 안 가고 있다
왜지>??? 아 헐
callback function은 anonymous하다는 걸 또 잊어버렸고
그걸 또 글로 쓰는 도중에 생각이 났다
멍청인가봐...
그래도 답을 알아서 속시원해짐ㅋㅋㅋㅋㅋ
기억해...
callback function is always anonymous...