Node.js process.version Property
Last Updated :
12 Oct, 2021
The process.version property is an inbuilt application programming interface of the Process module which is used to check the node.js version.
Syntax:
process.version
Return: It returns a string signifying the version of the Node.js.
Below examples illustrate the use of process.version property in Node.js:
Example 1:
const process = require( 'process' );
console.log( "node.js version " + process.version);
|
Output:
node.js version v10.16.0
Example 2:
const process = require( 'process' );
const ver = process.version;
console.log( "node.js version " + ver);
var name = "" ;
if (ver.startsWith( 'v10.' )) {
name = 'Dubnium' ;
} else if (ver.startsWith( 'v8.' )) {
name = 'Caron' ;
} else if (ver.startsWith( 'v6.' )) {
name = 'Boron' ;
} else if (ver.startsWith( 'v4.' )) {
name = 'Argon' ;
} else {
name = 'unknown' ;
}
console.log( "Node.js version name: " + name);
|
Output:
node.js version v10.16.0
Node.js version name: Dubnium
Reference: https://nodejs.org/api/process.html#process_process_version
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...