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.
Instagram β Twitter β Facebook
Micro-Learning β Web Development β Javascript β MERN stack β Javascript
codedrops.tech
Top comments (0)