If I understand correctly the callback function?

Welcome!

For training, wrote a simple example:
function f(value, delay, callback) {
 setTimeout(() => {
callback(value);
 }, delay);
}

f(true, 500, callback => console.log(callback));


If I understand correctly the callback function?
March 23rd 20 at 19:45
2 answers
March 23rd 20 at 19:47
Solution
Not entirely successful, the name of the callback argument function call (last line).

Isf(true, 500, callback => console.log(callback));
maybe better
const myCallback = arg => console.log(arg);
f(true, 500, myCallback);
March 23rd 20 at 19:49
whether you realize callback function for this piece of code does not understand
better tell us why you return inside setTimeout
I agree, return the excess, corrected. - chloe.Rice commented on March 23rd 20 at 19:52

Find more questions by tags JavaScript