Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns an id which may be used to cancel the timeout.
note: only js2.0 support
setTimeout(() => { console.log('hello'); }, 500); Copy
setTimeout(() => { console.log('hello'); }, 500);
callback function to execute when timer expires
Rest
Optional
delay in ms
arguments passed to callback function
Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns an id which may be used to cancel the timeout.
note: only js2.0 support