JavaScript is a predominantly
interpreted language by its design, but, yes, V8 compiles JavaScript to native machine code. Please read about it:
http://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29[
^],
https://developers.google.com/v8[
^].
The problem is: JavaScript dynamic behavior presents a serious barrier for compilation. Anyway, V8 does what it does. Please read more about JavaScript:
http://en.wikipedia.org/wiki/JavaScript[
^].
However, "compilation" can be applicable to JavaScript in some other ways, only it doesn't make it a compiled language. For example, Closure Compiler "it compiles from JavaScript to better JavaScript":
https://developers.google.com/closure/compiler[
^].
Only in this sense, it's claimed to be a "true compiler". The term "compilation" is very wide, so you need to focus only on the notion of compiled languages, vs.
interpreted languages:
http://en.wikipedia.org/wiki/Compiled_language[
^],
http://en.wikipedia.org/wiki/Interpreted_language[
^].
Anyway, in certain sense, it is possible to have such interpreted language which allows to create code which cannot be compiled in principle. It means that the only correct compilation would need to create a whole model (simulator) of target system with embedded interpreter which would be used during runtime. Creation of such language is not a trivial problem.
—SA