Ruphaa's Notes

How to invoke the provided function after wait (in milliseconds)?

js

const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
delay(
function (text) {
console.log(text);
},
1000,
"later"
);

// Logs 'later' after one second.