user220583
user220583

Reputation:

How do browsers execute javascript

I'm trying to figure out if web browsers use an interpreter to execute javascript, or some sort of compiler. It is well known that scripting languages are interpreted not compiled; however there is the JScriptCompiler that can compile javascript into MSIL. This leaves me to wonder if IE, FF, Chrome etc are using some sort of compiler or if it's an interpreter.

Can anyone cite the specific method in which browsers run javascript?

Upvotes: 37

Views: 33223

Answers (4)

Mohsin Ahmed
Mohsin Ahmed

Reputation: 17

JScript is a scripting language provided by microsoft. Its compilation is taken care by CLR. Also it can be interpreted. It have tighter integration with Visual studio.

Have a look at http://msdn.microsoft.com/en-us/library/72bd815a%28v=vs.80%29.aspx for detail Jscript description.

Upvotes: 1

Frizi
Frizi

Reputation: 2940

javascript scripts are usually interpreted in web browsers (not sure about chrome and V8), but here and there you can find some standalone software which can compile it more or less correctly. This language isn't as fast as many other and his speed and functionality depends on browsers engine.

Upvotes: 0

Pascal MARTIN
Pascal MARTIN

Reputation: 401002

In the past, Javascript was interpreted -- and nothing more.

In the past two years or so, browsers have been implementing new Javascript engines, trying to compile some portions of code, to speed Javascript up.


For more informations on what has been done for Mozilla Firefox, you should take a look at :

For more informations about Chrome's engine, you'll want to read :

And for webkit (safari) :

Not sure what has been (or is being) done on other browsers -- but I suppose the same kind of thing exists, or will exist.


And, of course, for more informations : JavaScript engine, on wikipedia.

Upvotes: 30

Related Questions