Determines whether the current environment is Node.js.
Checks for the presence of the process object and its versions.node property, which are specific to the Node.js runtime.
process
versions.node
true if running in a Node.js environment, otherwise false.
true
false
isNode(); // true in Node.js, false in browsers or other non-Node environments Copy
isNode(); // true in Node.js, false in browsers or other non-Node environments
Determines whether the current environment is Node.js.
Checks for the presence of the
processobject and itsversions.nodeproperty, which are specific to the Node.js runtime.