Answers for "nullish-coalescing-operator"

0

nullish-coalescing-operator

let foo = { someFooProp: "hi" };

console.log(foo.someFooProp?.toUpperCase() ?? "not available"); // "HI"
console.log(foo.someBarProp?.toUpperCase() ?? "not available"); // "not available"
Posted by: Guest on January-06-2021
0

nullish-coalescing-operator

null || undefined ?? "foo"; // raises a SyntaxError
true || undefined ?? "foo"; // raises a SyntaxError
Posted by: Guest on January-06-2021

Browse Popular Code Answers by Language