Javascript: How to pass functions as parameters?
The code is supposed to successfully run the function values that are passed into the loop function.
Any help would be greatly appreciated.
function loop(value, test, update, body){
for (let i = 0; i < 10; i++){
if (test(i, value)) break;
update(value);
console.log(body(i));
}
}
loop(5, (i, value) => { return i > value }, (value) => {return value + 1}, (i) => {return i*2;});