double question mark vs && in javascript

93 views Asked by At

here's what the purpose of using ??

//Similar to || but only returns the right-hand operand if the left-hand is null or undefined
0 ?? "other" // 0
false ?? "other" // false
null ?? "other" // "other"
undefined ?? "other" // "other"

but I normally use &&, so what's the difference?

0

There are 0 answers