Node.js process.version Property
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:
// Allocating process moduleconst process = require('process'); // Printing process.versionconsole.log("node.js version " + process.version); |
Output:
node.js version v10.16.0
Example 2:
// Allocating process moduleconst process = require('process'); // Printing process.versionconst ver = process.version;console.log("node.js version " + ver); // Printing version namevar 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


Please Login to comment...