JavaScript to Machine Code

Thiwanka Wickramage
3 min readApr 24, 2023

We all know about JavaScript, but have you ever wondered how it turns into machine code? What’s happens inside the JS engine? If you want to learn more, let’s get into it.

What is JavaScript Engine

Let’s start with understanding what JavaScript engine is. Basically, a JS engine is just a software component, like any other software component. This software is designed to execute your JavaScript code.

The first engine was a basic interpreter program, but with technological improvements, all relevant modern engines now use just-in-time (JIT) compilation for improved performance. These engines might have its own ways to improve performance but the baseline is same

Before we dig deep into engines, let’s clarify some terms.

What is interpreter

You know, every program that we are coding is a set of instructions. Even adding one number to another or making API request to another service these all are set of instructions.

What we are coding is a high-level programming language so computer cannot understand it directly. That’s why we need Interpreter or Compiler program.

Let’s find out what are the key difference between Interpreter and Compiler

Compiler converts our code

--

--