2.2 C
London
Thursday, November 28, 2024
HomeEducation5 New JavaScript Features in ES 2020 – Brain Mentors

5 New JavaScript Features in ES 2020 – Brain Mentors

Date:

Related stories

Student Tribe Brings Back India’s Biggest Student Talent Hunt!

The winner gets a reward of ₹2 lakhs Student Tribe,...

DPS, New Town, Kolkata wins National Finals of Aqua Regia – The School Quiz 2024

Triumphant Institute of Management Education Pvt. Ltd. (T.I.M.E)...

HPCL partners with The Akshaya Patra Foundation to feed 1000 School Children for a Year

Hindustan Petroleum Corporation Limited (HPCL) has partnered with The...

In this Blog we are going to learn ES 2020 Key Features.ES2020 released on Start of this year.
Here we are going to learn some really cool features of ES 2020

Let’s start with Feature 1 : Nullish coalescing
Use when the value is missing (undefined or null (It doesn’t work with NaN , ‘’, 0)).
The undefined and null are the nullish value , and you want to handle it then we use nullish coalescing operator.
Example:
image
In above example , country is not there so it does show undefined And I want to print some meaningful result
Before ES 2020 we use truthy and falsy
image
It just checks if the first value is true then don’t go to the second value ,
if first is false (undefined or null ) then go to the second value.
Instead of PIPE Now Use Nullish Operator from ES 2020
image

Feature 2 : Optional Chaining Operator
Nested Object Property access can be dangerous , if any of the property is null or undefined.
Example :
image

Read Full Article Here – https://brain-mentors.com/5-new-javascript-features-in-es-2020-brain-mentors/

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories