DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on

Nullish coalescing operator

const height = 0;

console.log(height || 100); // 100
console.log(height ?? 100); // 0
Enter fullscreen mode Exit fullscreen mode

Nullish coalescing operator (??) returns the right-hand side value only if the left-hand side value is undefined or null


Thanks for reading 💙

Follow @codedrops.tech for daily posts.

InstagramTwitterFacebook

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript

codedrops.tech

Top comments (0)