Javascript setTimeout() method

setTimeout() method is called when delay time has finished. it is not executed immediately. If there are two function setImmediate and setTimeout are called in the current event loop cycle then first call setImmediate after that setTimeout.


setTimeout(() => {
                console.log('set Timeout Call');
            }, 0);
            
 
  setImmediate(()=>{
 
  console.log("set Immediate Call")
 
 })
Output:- set Immediate Call
set Timeout Call

The clearTimeout() method in javascript clears the timeout which has been set by setTimeout() function.