SetTimeout and callback function

vahid_jani
1 min readJun 18, 2022

1-. Why the “setTimeout” function ? we use it to run a function at some point in the future. As the first parameter it gets a callback function but remember we do not call the function here (if we do that it will run it immediately and we dont want that), So just give the name of the function we want to run. as the second argument it receives the future time in milliseconds. lets see an example:

console.log('running line 1');function alertFunc(order) {console.log(`your ${order} is ready`);

--

--