What is Javascript and Why it is popular?

Ms Chi
1 min readSep 10, 2022

Javascript is a single threaded programming language, that means it only has ONE call stack and ONE memory heap which is responsible for ONE task at ONE time. If it only does ONE task per ONE time, it is such a big waste of time and resources! And yes, asynchronous is the rescuer.

console.log('1');setTimeout(() => {console.log('2');}, 3000);console.log('3');

For the sample code above, console.log('2') will be added in the callback queue and waiting to be pushed into call stack after setTimeout is completely executed in Web Api.

As soon as event loop checks that the call stack is empty and there is something in the callback queue, it will place that statement in the call stack and that is the moment where console.log('2') will be executed.

Okay. At this point, you should agree that Javascript is a single threaded programming language and it supports ASYNC.

Why it is popular?

  1. It runs everywhere
    JavaScript can run everywhere in both frontend and backend development of web and mobile applications.
  2. Full-stack development by modern framework
    - React, Vue, Angular are the modern frontend framework used for Javascript.
    - NestJs, ExpressJs are the modern backend framework used for NodeJs.
  3. Flexibility
    -
    typescript is the superset of JS, static type…

--

--

Ms Chi
Ms Chi

Written by Ms Chi

A typescript JS people who breathes React and Node. Long term learning curve is a must to keep us fresh and competitive. Don’t be overwhelmed by the speed.