7
According to V8 documentation, it compiles Javascript for machine code, as an optimization strategy.
Thus, the Javascript that runs on the server via Node.js is compiled or interpreted?
7
According to V8 documentation, it compiles Javascript for machine code, as an optimization strategy.
Thus, the Javascript that runs on the server via Node.js is compiled or interpreted?
2
It is interpreted and then compiled "on the fly" JIT with V8.
Unlike Java, which compiles code in bytes and then compiles code for something the machine can understand, Nodejs remains Javascript and then Javascript is compiled at "runtime".
Reference: https://hashnode.com/post/is-nodejs-compiled-or-interpreted-language-cijylh0ed00keco5318e1em8p
2
Because Nodejs uses the Javascript V8 engine, its code is compiled on time to bytecode V8 virtual machine. Before this compilation, it solves the imports
of modules and optimizes code logic.
You can compare Nodejs to a PHP, Python, Java, or ASP.NET server: The code is optimized and compiled for an intermediate assembly language (called bytecode -- similar to the Assembly).
Remember that even if Nodejs and the other languages have access to some functions of the machine or operating system, whoever executes this compiled code is the virtual machine/interpreter of the language. That is: by default Java uses the JVM (Java Virtual Machine), PHP uses the PHP interpreter based on the Zend Engine, Python uses the Python interpreter of its distribution (Jython, Ironpython, Cpython, Pypy) and ASP.NET uses the CLR of . NET Framework.
Browser other questions tagged javascript node.js
You are not signed in. Login or sign up in order to post.