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.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct