Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

double question mark javascript

Nullish coalescing operator (??)
returns its right-hand side operand when its left-hand side operand is null or undefined, 
and otherwise returns its left-hand side operand.
const foo = null ?? 'default string';
console.log(foo);
// expected output: "default string" because left hand side is null.

const baz = 0 ?? 42;
console.log(baz);
// expected output: 0 , because left hand side ( 0 )  is not null or undefinded.
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #double #question #mark #javascript
ADD COMMENT
Topic
Name
4+8 =