How JavaScript Eventually Becomes 0110101110

Jacob Lozano
3 min readSep 29, 2020

When you type the special moon runes into your Text Editor, how does your Chrome know that you’re trying to print “Hello World” to your console? Is it really as simple as a JavaScript engine running your high level code through a interpreter/JIT compiler combo, passing it through an Assembler to generate the appropriate object code which then gets linked/loaded into your computers memory to be ran by the computer? Good guess!

Step 1: From Software to Hardware

This is the first step of the deconstructing process. Organizing your code into more digestable code (called Assembly). The difference between a compiler and an interpreter is simple: a compiler frontloads the work while an interpreter works by directly executing the high level source code line by line. The trade offs are apparent, you want low initial load times so JIT interpretation seems great, but you want an efficient app so maybe a compiler is in your app’s best interest.

Google’s V8 JavaScript Engine

In the case of Chrome, Google has developed a sophisticated and ever changing engine that does BOTH. Right off the bat, the code is parsed into bit-sized chunks called tokens that will be feed into the interpreter. This generally inefficient code is analyzed in tandem with its output, meaning that as the code is given to Chrome to run, it is also being watched by the ever present…

--

--