Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is javascript interpreted or jit compiled

Is JavaScript translated from source code to machine code with a JIT compiler or an interpreter? Or does it depend on the browser and the JavaScript engine you are running?

like image 804
Overste Avatar asked Jul 16 '16 11:07

Overste


2 Answers

Javascript is an interpreted language.It is directly interpreted by browsers for execution.

But,modern browsers support JIT compilation which converts it to bytecodes for high performance.

like image 100
Anands23 Avatar answered Sep 19 '22 01:09

Anands23


JavaScript is scripting language and browser is executing scripts which are in text format. So by definition that makes JavaScript interpreted language.

Compiled languages are those which are executed from binary files.

JIT compilation is just something that JavaScript engines can do as way of optimization, but you never truly generate binary JS files, so language is interpreted one.

like image 41
sielakos Avatar answered Sep 20 '22 01:09

sielakos