Node.js process.version Property
Last Updated :
12 Oct, 2021
Improve
The process.version property is an inbuilt application programming interface of the Process module which is used to check the node.js version.
Syntax:
javascript
Output:
javascript
Output:
process.versionReturn: 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:
// Allocating process module
const process = require('process');
// Printing process.version
console.log("node.js version " + process.version);
node.js version v10.16.0Example 2:
// Allocating process module
const process = require('process');
// Printing process.version
const ver = process.version;
console.log("node.js version " + ver);
// Printing version name
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);
node.js version v10.16.0 Node.js version name: DubniumReference: https://nodejs.org/api/process.html#process_process_version