Javascript Processing in browser

1.5k views Asked by At

Possible Duplicate:
How does a JavaScript parser work?

How do browsers compile Javascript scripts? What type of compiler it used?

3

There are 3 answers

0
Sampson On BEST ANSWER

JavaScript isn't compiled, but rather parsed and interpreted. This differs from browser to browser.

Chrome, uses V8, which happens to also be used by node.js. Internet Explorer has a proprietary engine known as Chakra.

As for general rules, the Annotated ES5 shares some insight:

The source text of an ECMAScript program is first converted into a sequence of input elements, which are tokens, line terminators, comments, or white space. The source text is scanned from left to right, repeatedly taking the longest possible sequence of characters as the next input element.

0
xdazz On

The browsers don't compile javascript, it just parse the file and execute it.

Look here: JavaScript_engine

0
Tom On

Javascript gets interpreted; this is like compiled on the fly, while running, when needed. That's why a page with javascript errors will just work until a part of bad code gets used. the bad code block will just stop.