---
title: "Discussion on \"JavaScript Interpreted or Compiled? The Debate is Over.\" | Hashnode"
description: "Discussion on \"JavaScript Interpreted or Compiled? The Debate is Over.\". Introduction\nAs a beginner to the JavaScript programming language, I had faced this question so many times:\n\nDoes JavaScript Interprets the Source code, or it really Compiles?\n\nMany of the answers that I found on the internet made me as Confused as,\n..."
url: "https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [JavaScript Interpreted or Compiled? The Debate is Over.](https://blog.greenroots.info/javascript-interpreted-or-compiled-the-debate-is-over?utm_source=hashnode&utm_medium=feed)

Introduction As a beginner to the JavaScript programming language, I had faced this question so many times: Does JavaScript Interprets the Source code, or it really Compiles? Many of the answers that I found on the internet made me as Confused as, ...

Jun 4, 2020 · 4 min read · blog.greenroots.info  
Updated Oct 28, 2021  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#programming](https://hashnode.com/tag/programming)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#js](https://hashnode.com/tag/js)

## Written by

[Tapas Adhikary](https://hashnode.com/@atapas)

@atapas · Bangalore

  
[View profile](https://hashnode.com/@atapas)

Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source

Co-Founder, @CreoWis | Teacher, @tapaScript | Founder, @ReactPlay | YouTuber | Writer | Human

## Responses 4

Markdown supported · ⌘↵ to post

[Ian Mugenya](https://hashnode.com/@GeekneeUs)

[Jun 24, 2022](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/62b541d892447c9aed5b3e45)

I've never come across someone who explains programming in such a concise and digestible manner. This was a great read.

[A Vinay Kumar](https://hashnode.com/@avinay)

[Apr 28, 2021](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/6089114ec4c9d65257ea274c)

superb!!!

[Mario Giambanco](https://hashnode.com/@mgiambanco)

[Jun 5, 2020](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/5eda93549e4fb8424edcc57c)

The gist of your argument (IMO) is that because JS follows "some" similar processes of a compiler (tokenizing, specifically) that it is in fact, compiled. The problem with this argument, as [j](https://hashnode.com/@chilimatic) stated, is that all languages would fall into this and that's not correct.

When anything is actually compiled, it's expected to act and operate identically on all hardware and os's it's compiled for. If I write an iOS app in Swift and it's compiled for iOS, I can expect that app to work exactly the same on any platform that can run an iOS app (obviously, different versions of iOS may produce different results but that's getting off topic)

VS Chrome has a Javascript engine, Safari has a Javascript engine, Firefox has a .... Javascript engine. And while some of these browsers may use the same engine as a base, this is also why "sometimes" things work fine in Chrome and IE and sometimes they don't. They are all processing the JS as it comes in and "interpreting" it as they're designed to do so.

In a compiled JS app - they wouldn't. The code would be executed and the result is the result every time.

Another point, going further down this rabbit hole - a compiled language usually means the OS or the machine itself is executing the code directly. If JS was compiled, there would be no reason for the browser to execute and interpret the code. Now you could say Chrome is the "os" in this case and Chrome is executing the compiled code but IMO that's a stretch. There is still an engine looping through and interpreting the code. iOS, MacOS, Windows, Linux, et all are not interpreting compiled code - they're simply executing it.

[j](https://hashnode.com/@chilimatic)

[Jun 5, 2020](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/5eda93549e4fb8424edcc57c#reply-5eda97314732ec214e6a0eec)

> Another point, going further down this rabbit hole - a compiled language usually means the OS or the machine itself is executing the code directly.

java is compiled, c# is compiled both are not running natively. Although the new javac coming up will allow native AOT compilation.

> In a compiled JS app - they wouldn't. The code would be executed and the result is the result every time.

that's a tricky one. it depends on the linking process. If I use dynamic linking (.dll, .so) I actually use foreign ABIs in my compiled code so they could fail from system to system. at least in C, C++, Rust I got those problems I cannot talk about the other ones.

Also it would depend on the compile target that's the main reason why the VM exists so the translation between Highlevel and lowlevel isn't that complicated. Usually it's Highlevel -> stackmachine / VM -> asm target -> machine language

before I was writing my own compiler I would've taken a similar stance to be fair. It really gets tricky and hard to answer esp since JIT which basically takes the compiled code (VM/Interpreter -> fun fact Java starts 'somewhat interpreted' usually), creates statistical data about it and changes the execution layout and compiles 'more and more, based on the behaviour'

Still compiled as you actually mentions would mean that the VM code is 'listed' (compilare). But even here we could argue.

I don't wanna bore you further. it is just really tricky and it's like quantum physics and chemistry at which point do they merge? I really prefer pointing at the 'preprocessing' shit since a jvm always starts with the VM code and js just 'can' start with the VM code (caching).

that's the core difference and actually the 'interpreter' debate is off because we're actually debating 'script' vs 'compiled' to some degree.

anyhow ... bla

[j](https://hashnode.com/@chilimatic)

[Jun 4, 2020](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/5ed8cf716f01b6ea4e95462e)

based on this definition php, python, perl are also compiled languages. actually every language that has a VM is compiled.

I know the definition changed over the years, but the reason those languages are not considered 'compiled' is the preprocessing/optimization step not the transformation itself. But ofc we could argue esp since graal in Java now supports compiled javascript to java-vm code and other things.

also since ES6 gets 'transpiled' it gets fuzzy quick. still it remains an interpreted language with JIT qualities to me.

[j](https://hashnode.com/@chilimatic)

[Jun 4, 2020](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/5ed8cf716f01b6ea4e95462e#reply-5ed8f8916f01b6ea4e95477c)

[Tapas Adhikary](https://hashnode.com/@atapas)

> I have taken the answer is closer to Yes than No

not really, the translation into the VM is a common step. js does JIT compilation though. and it's translated and executed on the fly. so ... nah ... or every modern interpreter language that does not basically just use `eval` is a compiled language.

Also there are no real optimizations or compile checks done in the compilation .... they are runtime checks mainly.

To me it's not closer to a compiled language than any other language with a VM. also it's a lot about NFA to DFA transformations which also don't really happen. There are a lot of subtle differences from the perspective of someone building a compiler.

But maybe it's just because I am building a compiler at the moment that I am so picky about this statement.

[Tapas Adhikary](https://hashnode.com/@atapas)

[Jun 4, 2020](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/5ed8cf716f01b6ea4e95462e#reply-5ed90743e6da1cf54d5e3829)

[j](https://hashnode.com/@chilimatic) No problem at all.. Glad to have this healthy discussion and hoping others will benefit too.

BTW.. All the best for your Compiler Development project. 👍

[j](https://hashnode.com/@chilimatic)

[Jun 4, 2020](https://hashnode.com/posts/javascript-interpreted-or-compiled-the-debate-is-over/5ed8716a6f01b6ea4e9542bc/comment/5ed8cf716f01b6ea4e95462e#reply-5ed908d96f01b6ea4e954842)

[Tapas Adhikary](https://hashnode.com/@atapas) thx ^^
