This year ECMAScript 2020 (ES2020) will be released! Since ECMAScript 2015 (ES6) was released in 2015, we have gotten yearly updates to the JavaScript language.

In ES2020, we are getting a feature that has been available in other languages like C# and PHP: null coalescing operator. I’ve always liked the name because it makes me feel smart whenever I say it.

The null coalescing operator will go through a list and return the first item that is not null or undefined.

It is important to note that the null coalescing operator only looks for null or undefined values. Falsy values are accepted by the null coalescing operator.

#javascript #programming #null

JavaScript's Null Coalescing Operator
1.30 GEEK