Skip to content

Latest commit

 

History

History
8 lines (6 loc) · 255 Bytes

defer_execution_of_a_function.md

File metadata and controls

8 lines (6 loc) · 255 Bytes

Defer execution of a function

This snippet delays the execution of a function until the current call stack is cleared

const defer = (fn, ...args) => setTimeout(fn, 1, ...args);

defer(console.log, 'a'), console.log('b'); // logs 'b' then 'a'