What language is JavaScript written in?

Javascript

Javascript Problem Overview


If it's a scripting language as the name implies it must be written in a lower level language right? Like how PHP is written in C what language is JavaScript written in?

Javascript Solutions


Solution 1 - Javascript

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

Chrome's Javascript engine, V8, is written in C++.

From the project page: >V8 is written in C++ and is used in Google Chrome, the open source browser from Google. > > V8 implements ECMAScript as specified in ECMA-262, 5th edition, and > runs on Windows (XP or newer), Mac OS X (10.5 or newer), and Linux > systems that use IA-32, x64, or ARM processors.

Firefox's Javascript engine, SpiderMonkey (and now TraceMonkey) is also written in C++. And as maerics below said, Rhino is written in Java.

Solution 2 - Javascript

All the answers so far are correct, but since it hasn't been mentioned yet, JavaScript can be written in JavaScript.

Solution 3 - Javascript

Most Javascript interpreters are written in C/C++ (V8, Nitro, etc…), however a compliant interpreter can be written in any language (Rhino→Java, Interpreter→Javascript, etc…).

Solution 4 - Javascript

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

Most of the major implementations (standalone or as parts of web browsers) out there tend to be largely written in C or C++ for performance reasons, but that's not necessarily always the case. Rhino, an engine maintained by Mozilla, is written in Java.

Solution 5 - Javascript

Whichever language the client webbrowsers javascript interpreter was written in :)

Solution 6 - Javascript

Most implementations of Javascript show behaviour that is clearly caused by the use of pointers and byref parameter passing, which normally points towards the use of C, or C++

This is clearly notable for instance when you are taking apart a multidimensional array in a loop, with the help of intermediate array's. These tend to behave very "strangely", if you are not familiar with pointers and byref passing of parameters (You need do var hlp = new Array() each time or it will overwrite the previous values which you already stored somewhere else)

I'm rather curious as to how an implementation of javascript in for instance Java, because I imagine that this kind of behaviour will be quite different in that case?

Solution 7 - Javascript

C++ is the fundamental language for anything modern and fancy. Most modern high level languages are subset of low level language,C++. All modern languages you see today is a subset of C++ someway or the other. Even Java is a subset of C++.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSergioView Question on Stackoverflow
Solution 1 - JavascriptSeth CarnegieView Answer on Stackoverflow
Solution 2 - JavascriptMatthew CrumleyView Answer on Stackoverflow
Solution 3 - Javascriptgf3View Answer on Stackoverflow
Solution 4 - JavascriptdfreemanView Answer on Stackoverflow
Solution 5 - JavascriptTom StudeeView Answer on Stackoverflow
Solution 6 - JavascriptRients DijkstraView Answer on Stackoverflow
Solution 7 - Javascriptuser9786492View Answer on Stackoverflow