The
os.version() method is used to identify the version of the kernel of the Operating System. This information is determined by calling
uname on POSIX systems and calling
RtlGetVersion() or
GetVersionExW() on Windows systems.
Syntax:
os.version()
Parameters: This function does not accept any parameters.
Return Value: It returns a string that identifies the kernel version.
Below programs illustrate the
os.version() method in Node.js:
Example 1: On POSIX
Output:
OS Version: #24~18.04.1-Ubuntu SMP Mon Jul 28 16:12:28 UTC 2019
Example 2: On Windows
Output:
OS Version: Windows 10 Enterprise
Reference: https://nodejs.org/api/os.html#os_os_version