Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js nullish

const foo = null ?? 'default string';
console.log(foo);
// expected output: "default string"

const baz = 0 ?? 42;
console.log(baz);
// expected output: 0
 
PREVIOUS NEXT
Tagged: #js #nullish
ADD COMMENT
Topic
Name
6+1 =