loading...

Nullish coalescing operator

318097 profile image Mehul Lakhanpal ・1 min read
const height = 0;

console.log(height || 100); // 100
console.log(height ?? 100); // 0

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

Discussion

pic
Editor guide