How JavaScript Works?

The Computer Science Behind JavaScript

This is an awesome coding video that explains how JavaScript works. It is part two of a series which in its first part goes into the history of JavaScript. Now, the video goes into the detail of it's high-level, single threaded, and garbage collection mechanisms. It also touches how JavaScript is interpreted(JIT), prototype-based, multi-paradigm, and dynamic. Also, it explains the non-blocking event-loop of JS. So first what does high-level programming means?

JavaScript is High-Level Programming

When we say high-level programming, it only means that the language gives a simplified version of all the interaction that happens in the lower(hardware) level part of the computer. It is an abstraction or simplification over machine code, which is the lowest level programming language. If we order programming languages based on their abstraction level, from higher to lower, it would be like this:

  • JS/Python,
  • C/C++,
  • Assembly,
  • Machine code.

JavaScript is Interpreted

It needs to have an interpreter in the environment to read and execute the code. Unlike compiled languages like Java, interpreted languages don't statically analyze and compiles into binary.

JavaScript is Dynamic Weakly Typed Language.

A dynamical type language means we don't explicitly code the type of variables or functions. Instead, the type is determined at runtime.

JavaScript is Multi-Paradigm Language

This just means that JS allows as to use and combine declarative functional approaches, or object-oriented approach.

JavaScript is Prototype-based

What we mean by prototype based is that JS treats everything in it as an object which all have a direct or indirect relationship with Prototype. This creates a prototype chain, where one object can inherit from another object.

These five properties of JS are based on ECMA definitions. However, the rest of the important part of JS is defined or specified by browser vendors. These specifications include JS's single threaded feature, garbage collection, non-blocking, and JIT event-loop.

This video nicely explains these concepts too. So, I encourage you guys to watch it.

Subscribe for coding videos

Keep growing professionally with just three curated videos weekly.

We hate spam as much as you do.