Modern JS
-
The nullish coalescing operator (??) is a relatively new addition to the JavaScript language (introduced in ES2020). It is a logical operator that returns the right side operand when the left side operand is null or undefined, and otherwise returns the left side operand. It is similar to the logical OR operator (||), however it…
-
Up until now, we only had two ways to write a string in JavaScript – single and double quotes. If we wanted to interpolate a variable with one of these string options, we’d need to break out of the string and concatenate the variable. As of ES2015, we are able to use Template Literals (AKA…
-
New with ES6, we have an additional way to write function expressions in our code – as arrow functions. This new syntax offers 3 main benefits: They are much more concise than regular function expressions/definitions They have implicit returns, which allow us to write single-line expressions (much like we can do with conditionals and the…
-
As of ES6, we have two new ways to define variables, in addition to the classic var keyword. Each are a little bit different in their own way and I’ll break down those differences in this article.