sasivarnan
4/29/2016 - 11:50 AM

JavaScript - Single Threaded

JavaScript - Single Threaded

(function(){ 
  console.log(new Date().getTime()); 
  setTimeout(function(){
    console.log('set'); 
    console.log(new Date().getTime());
    
  },0); 
  for(var i = 0; i< 100; i++){
    //do some heavy synchronous operations
  } 
  console.log(new Date().getTime()) 
  
})();