Invokes func after wait milliseconds. Any additional arguments are provided to func when it is invoked.
I can't think of a good way to pass undefined amount of additional arguments into the callback function. Any suggestion?
function delay(func, wait) {
return setTimeout(func, wait);
}
// func will run after wait millisec delay
// Example
delay(hello, 100);
delay(hello, 100, 'joe', 'mary'); // 'joe' and 'mary' will be passed to hello function