invoke the provided function after wait (in milliseconds)

PHOTO EMBED

Sat Feb 26 2022 02:20:48 GMT+0000 (Coordinated Universal Time)

Saved by @mboljar

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

// Logs 'later' after one second.
content_copyCOPY

https://madza.hashnode.dev/24-modern-es6-code-snippets-to-solve-practical-js-problems?guid