Sign in
Log inSign up

Is Javascript Synchronous or Asynchronous ?

Default profile photo
Anonymous
·Apr 3, 2018

I am little bit confused ,according to theory Javascript is synchronous ,so if it is synchronous then the order of the output for below code should be :

console.log("Hi");
setTimeout(() =>{
console.log("My");
},2000);
console.log("you");

Hi My You

But output is coming as : Hi you My.