I am a beginner so it this may not be a very smart question .. If I have this function
function repeat (n,action) {
for(i=0;i<n;i++){
action(i)
}
}
if I implement it in this way repeat (3,console.log) it works.
why do I get an error if I pass it this parameters:
let arr = [0];
repeat(3,arr.push);
since action(i) will be replaced -as I think- with arr.push(i)