Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Logical Assignment Operator null coalescing

const a = null;
const b = 3;
a ??= b;
console.log(a); // returns 3
// the above statement is equivalent to
if (a === null || a === undefined) {
  a = b;
}
Source by betterprogramming.pub #
 
PREVIOUS NEXT
Tagged: #Logical #Assignment #Operator #null #coalescing
ADD COMMENT
Topic
Name
1+5 =