I am new to JS and had been learning with HOF/master it under the hood and I have been little confused, it says it calls a callback. but which part of code is callback? e.g.
const multiple = [1,2,3,4,5];
const result = multiple.map((num)=>{
return num * 2
})
console.log(result)
from my understanding is callback if a function u call inside of a HOF e.g.
function multiplyBy2(array, callback){
let newArr = []
for(let i = 0; i < array.length; i++){
newArr.push(callback(array[i]))
}
return newArr
}
function multiply(num){
return num * 2
}
console.log(multiplyBy2(arr, multiply))
so my question is, what is callback part in higher order function. here the working example of above