Is Javascript compiled or an interpreted language? [closed]
Asked Answered
I

2

186

Can Javascript be called a pure interpreted language? Or does it also have some compiled flavor to it? Could someone guide at the reasons behind both the things whichever being true.

Iodic answered 8/3, 2012 at 19:45 Comment(8)
Please consider adding a comment when voting down so that the question can be improved. Thanks.Iodic
I wonder what you believe a 'compiled' language is. Even exe's are interpreted by the OS, or else linux binaries would be interchangeable with windows ones for instance.Ardatharde
@Blindy: are you mentioning that the distinction between compiled and interpreted shouldn't be there at all?Iodic
Of course; what difference does it make?Ardatharde
@Blindy: But isn't this one of the very common way of classifying languages as?Iodic
It may be a common way of classifying languages, but that doesn't make it any more useful.Dvinsk
@NetEmp (note I havent downvoted - but have voted to migrate to programmers) This is the wrong place to ask this type of question - read the FAQ on what questions to ask here - this should be in the programming section of StackExchangeHyponasty
@ManseUK: Thanks for sharing this. Will take care in the future.Iodic
R
92

Go and read the answers to this question

https://softwareengineering.stackexchange.com/questions/138521/is-javascript-interpreted-by-design

The answer I accepted is excellent and should help answer your question.

For me personally, I am somewhat cautious of the idea of calling a language interpreted or compiled. It's an implementation decision, not part of the language specification. If you want to talk about compiled or interpreted JavaScript, ask it in the context of an actual implementation of the language specification.

Richthofen answered 8/3, 2012 at 19:57 Comment(0)
D
21

JavaScript is interpreted at runtime by the client browser. There is a tool called the Rhino JavaScript Compiler that supposedly compiles JavaScript into Java class files, though.

Durance answered 8/3, 2012 at 19:47 Comment(8)
What about V8 and the like?Dvinsk
V8 never included anything like an interpreter, and most major JS engines feature JIT compilers by now. Thus, saying that "JavaScript is interpreted" is obviously wrong (or maybe your definition of interpreter/compiler is).Dvinsk
@delnan: Thanks for the insight at V8. Thus, JS is not a purely interpreted language.Iodic
Rhino JavaScript Compiler. You know, if you want your interpreted language to be interpreted by a different interpreted language.Cad
Spidermonkey and Trident both use JIT compilers for JavaScript in the browser as well.Suttle
"JavaScript is interpreted at runtime by the client browser". No, unless you're talking about some personal browser you wrote that uses an interpreter.Scruple
As others have said, this has no longer been true for some time now. Yes, in the early days you could say Javascript was interpreted, but it has come a very long way since then.Intercalation
Javascript is compiled by v8 engine using JIT compiler. The difference between v8 compiler and c/c++ compiler is that v8 doesn't create intermediate bytecodes.Involuted

© 2022 - 2024 — McMap. All rights reserved.