First class funtions : just a feature that a programme language ether has or does not have.All it means is that all functions are values. There are no first class functions in practice. It's just a concept
Higher-order function: There are higher-order functions in practice. It's possible because the langauge supports the first-class function.
3/23
higher-order function? functions that work with other functions or they operate on or with other functions
-they can accept other functions as arguments
-return a function
먼저 다른 function을 argument로 받아들이는 예시를 한 번 보자
function callTwice(func) {
func();
func();
}
function rollDie() {
const roll = Math.floor(Math.random() * 6) + 1
console.log(roll)
}
callTwice(rollDie)
저기 보면 func를 argument로 두번 불러주는데
밑에 argument에 넣어줄 function 써주고
첫번째 function call 해주면 실행 됨 ㅋㅋ