What language is JavaScript written in?

If it is a scripting language, as the name implies, should it be written in a lower level language? Like how PHP is written in C, what language is JavaScript written in?

+59
javascript
Aug 10 2018-11-11T00:
source share
6 answers

Javascript is just a standard, more formally known as ECMAScript . It can be implemented in any language, like any standard.

Chrome Javascript engine, V8 , written in C ++.

On the project page:

V8 is written in C ++ and is used in Google Chrome, an open source browser from Google.

V8 implements ECMAScript as specified in ECMA-262, 5th edition and runs on Windows (XP or later), Mac OS X (10.5 or later), and Linux systems using IA-32, x64, or ARM processors.

The Firefox Javascript engine, SpiderMonkey (and now TraceMonkey) is also written in C ++. And as the maerics below say, Rhino is written in Java.

+98
Aug 10 2018-11-11T00:
source share

All answers are still correct, but since it has not been mentioned yet, JavaScript can be written in JavaScript .

+26
Aug 10 '11 at 4:23
source share

Most Javascript interpreters are written in C / C ++ (V8, Nitro, etc.), however a compatible interpreter can be written in any language (Rhino โ†’ Java, Interpreter โ†’ Javascript, etc.).

+10
Aug 10 2018-11-11T00:
source share

Whatever language the javascript interpreter of the client web browsers interprets :)

+6
Aug 10 '11 at 4:00
source share

Javascript is an implementation of the ECMAScript standard, but there is no singular canonical interpreter, as you can see with PHP.

Most major implementations (stand-alone or as part of web browsers) are typically heavily written in C or C ++ for performance reasons, but this is not always the case. Rhino, a Mozilla-supported engine, is written in Java.

+5
Aug 10 2018-11-11T00:
source share

Most implementations of Javascript behavior that are explicitly caused by using pointers and passing byref parameters, which usually indicate the use of C or C ++

This is certainly noteworthy, for example, when you parse a multidimensional array in a loop using an intermediate array. They usually behave very โ€œstrangeโ€ if you are not familiar with pointers and passing parameters (you need to always do var hlp = new Array () or overwrite previous values โ€‹โ€‹that you already store somewhere else)

I'm pretty curious how the javascript implementation is in Java for example, because I assume that this behavior will be completely different in this case?

+3
Sep 10 '13 at 19:42 on
source share



All Articles