Building Our Own Java Script

Sep 9, 2024

Building Our Own Java Script

Bruno, a tech leader at N26, takes us behind the scenes of JavaScript, uncovering the intricate mechanics of how engines like V8 and runtimes work to turn code into blazing-fast execution.

Author

Aditi Dixit
Aditi DixitContent Writer

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!

Subscribe to Our Newsletter

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
Insight
Why AI Agents Fail in Production: Building Systems That Recover | Pushkar
Sep 10, 2026

Why AI Agents Fail in Production: Building Systems That Recover | Pushkar

Pushkarโ€™s thegeekconf mini talk explores why AI agents that perform well in demos often struggle in production, and how loud failures, clean context, step monitoring, guardrails, and better agent loops can make them more reliable and predictable.

Insight
Building Is Not Shipping: An AI Agent for App Store Submissions | Gracey Dugar
Sep 8, 2026

Building Is Not Shipping: An AI Agent for App Store Submissions | Gracey Dugar

Gracey Dugar's thegeekconf mini 2026 talk explores why app store submission stalls most AI agent workflows, what an agent needs to finish the job, and a live demo from a single prompt to a published app.

Insight
No More Prompt-and-Wait: Building Autonomous Agents That Act | Kamal Shree
Sep 4, 2026

No More Prompt-and-Wait: Building Autonomous Agents That Act | Kamal Shree

Kamal Shreeโ€™s Geekconf miniโ€™s talk explores the shift to autonomous agents, from what separates agents from chatbots, the anatomy and grounding behind them, and how to choose between no-code, low-code, and pro-code build paths.

Insight
From UX to AX: Designing Applications for a World of AI Agents
Sep 4, 2026

From UX to AX: Designing Applications for a World of AI Agents

Learn how Ashita Prasadโ€™s thegeekconf mini 2026 session explores agentic experience and three approaches to building agent-ready applications: Web MCP, MCP Apps, and A2UI.

Insight
Agentic AI: From Copilot to Autopilot | Naveen Kumar Bhansali
Sep 4, 2026

Agentic AI: From Copilot to Autopilot | Naveen Kumar Bhansali

Learn how Naveen Kumar Bhansaliโ€™s thegeekconf mini 2026 session explores AI-driven software development, context engineering, enterprise adoption, agentic workflows, and the shift toward building products for AI agents.

Insight
Agentic Commerce: What Happens When Your Agent Tries to Spend Money? | Roopasree Ranganna
Sep 4, 2026

Agentic Commerce: What Happens When Your Agent Tries to Spend Money? | Roopasree Ranganna

Learn how Roopasree Rangannaโ€™s thegeekconf mini 2026 session explores agentic commerce, delegated payments, trust, identity, mandates, and the systems needed to enable AI agents to transact.

Events
โ€ŠFrom MVP to Scale: Designing Architecture for AI-First Products
May 11, 2026

โ€ŠFrom MVP to Scale: Designing Architecture for AI-First Products

A panel of architects and engineering leaders at thegeekconf mini 2026 discuss how to build and scale AI-first products โ€” from MVP decisions to production-level challenges. The conversation covers data quality, model selection, security, token economics, and the mindset teams need to navigate a fast-moving AI landscape.

The Right Conversation Can

Save You Six Months.

Book a call