Key changes in major Node versions
We know that all of the main versions are current for the next six months. However, as an application developer, it is vital to understand the latest three major Node versions, namely Node 18, Node 17, and Node 16, as well as the primary modifications and what has been introduced to make the application extremely performant.
Node.js version 18:
Node.js version 18 is given the codename of ‘Hydrogen’.
Major features of Node v18:
- Upgrade of the V8 engine to 10.1
- Global Fetch Enable by Default
- Core Test Runner Module
1) Upgrade of the V8 engine to 10.1:
Node.js uses a V8 JavaScript engine in the background, making JavaScript code compilation into native machine codes easy. And it also improves the performance of server applications.
In node v18, the V8 engine is upgraded to 10.1 which is part of chromium 101.
There are also new methods available in Node v18:
- upgrades in the Intl.Locale API
- findLast and findLastIndex() array methods
- Performance improvements for class fields and private class methods.
2) Global Fetch Enable by Default:
Fetch API is one of the most used to make an HTTP request on the web. Before node v18 developers need to install the packages to get responses from APIs and fetch the data.
In previous versions of the node to make HTTP requests, it needed the use of XMLHttpRequest API, and it increases the number of lines in terms of coding.
3) Core Test Runner Module:
Before node v18 there was no test runner available in the node. From v18 the test runner module will be available using the node: prefix.
With this implementation, there is no need for external packages for test runners from now on.
The node: test module helps in the easy creation of JavaScript tests that return output in TAP format.
Node.js version 17:
Major features in Node.js version 17:
- More promisified APIs
- Stack traces with Node.js version
1)More Promisified APIs:
It is a continuous initiative within the node project to provide promised-based node.js core APIs. In node v15 Timers Promises APIs and Streames Promises APIs were added.
In node v17, new promise-based APIs were added for the Readline module. It provides an interface to read data from a Readable Stream one line at a time.
2)Stack traces with Node.js version:
Stack traces are an important part of diagnosing errors, to help developers to find what went wrong. In node v17, the version of the node will be displayed at the end of the stack traces where fatal errors stop the execution.
Node.js version 16:
Major features in Node.js version 16:
- Node v16 is the first release to have built-in binaries for Apple silicon shipped with it.
- Implementation of standard Web Crypto API.
- Updated NPM to version 7.10.10
- Abort Controller was introduced in Node.js version 15 and is stabilized in version 16, and it allows to reject or abort any kind of promise-based API.
- String encoding methods atob and btoa for compatibility with web platform API.