Node.js & NPM
How does JavaScript and JavaScript engine work in the browser and node?
In this lesson, we are going to take a look at the JavaScript engine and its anatomy. We are also going to learn about JavaScript’s call stack, event loop, task queues, and various other pieces that make JavaScript as we know it works properly.
Before we take peek into the anatomy of the JavaScript engine and see how everything fits together, let’s first understand some of the basic concepts of JavaScript and a little history on its inception.
JavaScript in a nutshell
JavaScript is an interpreted language. This means we do not have to compile the JavaScript source code before sending it to the browser. An interpreter can take the raw JavaScript code and run it for you.
JavaScript is also a dynamically typed language, unlike C and C++. This means variables declared using var
can store any type of data type like int
, string
, boolean
and also complex data types like object
and array
.
The lack of type system is what makes JavaScript slow to run. A statically typed language can produce a much efficient…