Can not undestand why the arguments of functions f1000 and f1500 are not passed to the wrapper function delay.
For now I get undefined instead of the right results from test and test2.
function f(x) {
  console.log( x );
}
function delay(f, ms) {
    return function() {
        setTimeout(function(){ 
            var delayed = f.apply(this, arguments);
            return delayed;
        }, ms);
    }
}
var f1000 = delay(f, 1000);
var f1500 = delay(f, 1500);
f1000("test"); // must display "test"
f1500("test2"); // must display "test2"
 
    