There are now several forks of nodejs and some of them support JavaScript engines other than Google's V8 engine.
For my node code to see which JS engine it is running under, what is currently the best way?
The engines I am aware of are:
(I've asked a separate question about detecting which fork of nodejs is being used. This question is only about detecting the JS engine.)
Node. js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
What is V8? V8 is Google's open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others.
To summarize, Node. js is a cross-platform JavaScript runtime environment for servers and applications. It is built on a single-threaded, non-blocking event loop, the Google Chrome V8 JavaScript engine, and a low-level I/O API.
The JavaScript Engine is a program whose responsibility is to execute JavaScript code. All modern browsers come with their own version of the JavaScript Engine but the most popular one is Google's V8 Engine. Google's V8 engine powers Google Chrome browsers, as well as, Node.
The process
object contains a lot of information about the currently running process (in this case, node).
My process.versions
for example, contains the current version of V8:
process: {
versions: {
http_parser: '2.5.0',
node: '4.2.4',
v8: '4.5.103.35',
uv: '1.7.5',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '46',
openssl: '1.0.2e'
}
}
You should be able to query this object and determine the current engine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With