Hey everyone! Iโm thrilled to be here to talk about something we all know and loveโJavaScript. But hereโs the twist: weโre going deeper today. You see, JavaScript might be everywhere, but how many of us actually know whatโs happening behind the scenes when we hit โrunโ? Itโs not magicโitโs pure engineering beauty. So, letโs take a ride through the engine room and break down how JavaScriptโand interpreted languages like Python and Rubyโreally work.
JavaScript is Everywhere, but the Real Magic is in Its Mechanics
We all write code and see it run, but whatโs the secret sauce? Today, Iโll show you the real mechanics that make JavaScript fly. Itโs time to pull back the curtain and reveal how things truly workโfrom the first line of code to the magic that happens when it hits your screen. Spoiler alert: JavaScriptโs secrets are anything but boring.
Before we jump into the deep end, a little about me, Iโm Bruno, a tech leader at N26, where I help build platform engineering tools that our web engineers use to create incredible products. Monorepos, CI pipelines, and web infrastructureโthatโs my world. Iโm a big fan of programming languages in general, especially Reactโbut donโt judge me too hard on my front-end skills when we hit the demo. Itโs all part of the fun!
React Native Just Blew My Mindโand Itโs the Same Tech Running the Web
I was just watching some of the earlier talks on React Native, and honestly, my mind was blown. Did you know React Native has become this powerful? And the craziest part? The technology driving React Native is the same thing powering the browser. Weโre living in a time where web technology is merging and converging in the coolest ways possible, and Iโm here for it.
Quick Trivia: The Console Object Isnโt Even Part of JavaScript
Yeah, you heard that right! The console objects you use every day for debuggingโitโs not part of JavaScript. Itโs a gift from the runtime. Wild, right? Thatโs just one of the quirky things about how JavaScript interacts with the environment itโs running in, and today, weโre going to uncover many more surprises.
V8: The Engine That Makes JavaScript a Powerhouse

Letโs talk about V8, the JavaScript engine powering Chrome. Itโs not just fastโitโs an engineering marvel. V8 doesnโt just execute your code; it turbocharges it. When you load a website, V8 grabs the JavaScript file, shoves it into a parser, and transforms it into an Abstract Syntax Tree (AST)โa data structure that represents your program. But thatโs just the start.
Once the AST is built, Ignition, V8โs interpreter, jumps into action. It walks through the AST, executing each node, but hereโs where things get slick: if V8 detects that a part of your code is running hotโletโs say youโve got a function thatโs being called over and overโit passes it over to TurboFan, V8โs Just-In-Time (JIT) compiler, which turns your JavaScript into blazing fast machine code. Now, thatโs what I call turning your code into a Ferrari.
JavaScript Engines Are Cool, But the Runtime Is Where the Real Magic Happens
Engines get a lot of love, but hereโs the real secret: itโs the runtime that gives JavaScript its superpowers. The browser runtime is what gives you things like the window object, the console, and all those fancy APIs we use to interact with the web. None of those are part of JavaScript itselfโtheyโre injected by the environment. Mind blown yet?
If youโve ever worked with Node.js, youโve noticed that the runtime is different. Instead of DOM manipulation, youโre working with things like file systems, HTTP requests, and sockets. Thatโs the runtime in actionโtailored to the environment youโre running in. This is why companies like Bun and Deno are pouring resources into building faster, more efficient runtimes. Theyโre using different engines like Zig and Rust, but theyโre still harnessing the power of JavaScript.
Letโs Get Technical: Breaking Down JavaScriptโs Hidden Machinery

Alright, now that youโve got a taste of how V8 and runtimes work, letโs zoom in and see what happens when you write a simple JavaScript statement like let result = 1. What happens when you hit โrunโ? Weโre about to step into the brain of JavaScript.
Step One: Lexical AnalysisโTurning Code Into Tokens
The first thing that happens is lexical analysis. The JavaScript engine reads through your code, character by character, and breaks it down into tokensโthe fundamental building blocks. Think of it as the codeโs DNA, with tokens representing keywords, operators, literals, and more. Without tokens, JavaScript wouldnโt know whatโs whatโbut tokens themselves arenโt enough.
Step Two: ParsingโThe Brain Behind the Scenes
Next comes the parser, which takes the tokens and builds the Abstract Syntax Tree (AST). This tree represents the structure of your code but isnโt running anything yet. Itโs like a map of your program that V8 uses to understand the big picture. Once the AST is built, we move into interpretation and compilation, where the real magic happens.
Step Three: The InterpreterโTurning the AST into Action
Once the AST is ready, Ignition kicks in. It walks through the tree, node by node, and interprets what each part of your program should do. But thatโs not the end. Remember TurboFan? If a part of your code is running hot, TurboFan compiles it into machine code, which makes it run even faster. Itโs like watching your code go from walking to flying.
JavaScript Engines vs. Runtimes: Whatโs the Difference?

Hereโs a fun thought: the engine runs your JavaScript code, but the runtime gives it all the tools to interact with the world. In the browser, that means the DOM, the console, and all those APIs we use daily. In Node.js, the runtime gives you access to file systems, networking, and much more. Itโs like the difference between a car engine and the roadโyou need both to get anywhere!
The Future of JavaScript: Runtimes Are Evolving
JavaScript is changing faster than ever. Companies like Bun and Deno are building new runtimes to push the limits of what JavaScript can do. Bun is using Zig and JavaScriptCore (from Apple), while Deno is leveraging Rust. These new runtimes are built for performance and security, which means faster apps and better developer experiences.
Time for a Live Demo: Letโs See It in Action
Now, Iโve talked a lot about ASTs, interpreters, and engines, but itโs time to see it all come to life. In this live demo, Iโm going to show you exactly how a JavaScript program gets broken down, interpreted, and executed. Weโll walk through the lexing, parsing, and interpreting phases so you can see the magic happen in real-time.
JavaScript isnโt just a languageโitโs a journey from code to execution, and today, youโve seen how the engine and runtime work together to make it all happen. Whether youโre building a small app or working on the next big thing, understanding how JavaScript works behind the scenes can make you a better developer.
In the end, JavaScript is more than just a language we writeโit's a powerful system of engines and runtimes working behind the scenes to make our code come to life. By understanding how JavaScript is interpreted and executed, we unlock the potential to build faster, more efficient, and more innovative applications. Keep exploring the magic beneath the surface!







