You want to be sure that the value passed as the callback
parameter is really a function.
typeof
operator===
operatortoString()
and the call
methodGiven: a function that accepts a callback function.
function someFunction(callback) {
callback();
}
You want to create a function that creates a promise that delays for a given number of milliseconds.
Promise
objectsetTimeout()
functionCreate a function that accepts the number of milliseconds.
function delay(ms) {
...
}
You want to create a generic function, that produces for a given function the partial applied function.
apply()
methodslice()
methodDefine a function that accepts another function (the one that should be partial applicable).
function partial(fn /*, args...*/) {
...
}