hey, awesome article. just a small correction
let age = person.age ?? 35; // sets the value 35 if age is undefined, 0, null, '' etc
because of the null coalescing, if person.age === 0, the variable age is 0.
person.age === 0
age
0
const person = { name: 'Adhikary', age: 0 }; const age1 = person.age ?? 35; // => 0 const age2 = person.age || 35; // => 35
Big thank for helping me to correct the typo.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
hey, awesome article. just a small correction
because of the null coalescing, if
person.age === 0
, the variableage
is0
.Big thank for helping me to correct the typo.