Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaizka-allende/52964497188d044edbbf370d0ddaa95b to your computer and use it in GitHub Desktop.
Save gaizka-allende/52964497188d044edbbf370d0ddaa95b to your computer and use it in GitHub Desktop.
delayed function call
function addDelay(msg: string, ms: number) {
return () => {
setTimeout(() => {
console.log(msg);
}, ms);
};
}
const delayedSayHello = addDelay("Hello world!", 500);
delayedSayHello(); /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment