Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

?? in javascript

"??" is called Nullish coalescing operator.
return the right hand side of operator if left hand side is null or undefined.
For example.
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 0 is not null or undefined.
Comment

... in javascript

// The `...` operator breaks down an array to individual arguments.
// For example lets create an array,
let array = [1, 2, 3];

// And a function that will return a sum of 3 values.
function sum(x, y, z) {
	return(x + y + z);
}

// The `sum` function doesn't accept an array as a single argument,
// so a solution for this would be calling it individual indexes in the array:
sum(array[0], array[1], array[2]);

// Or we can just do:
sum(...array)
// does the same thing
Comment

?. in javascript

The optional chaining operator (?.) enables you to read the value of a
property located deep within a chain of connected objects without having
to check that each reference in the chain is valid.
Comment

... in javascript

let array = [...value]
Comment

PREVIOUS NEXT
Code Example
Javascript :: binary to decimal javascript 
Javascript :: update object in array state react 
Javascript :: use of this keyword in js 
Javascript :: run file with nodemon 
Javascript :: Accessing user input through js 
Javascript :: vue js change delimiters 
Javascript :: String operators in JavaScript 
Javascript :: create shadow root 
Javascript :: indefOf 
Javascript :: leaflet add scale 
Javascript :: js get path from url 
Javascript :: javascript remove function from object 
Javascript :: Add additional css class name in react app 
Javascript :: events onclick 
Javascript :: get string length js 
Javascript :: js promise api 
Javascript :: URLSearchParams 
Javascript :: syntax of reduce in js 
Javascript :: check if an input element has focus 
Javascript :: Updating javascript object property 
Javascript :: is there a function like range in react 
Javascript :: create multiple array buttons in javascript 
Javascript :: vue 3 
Javascript :: how to do when enter is pressed javascript do smething 
Javascript :: javascript global function 
Javascript :: javascript remove last element 
Javascript :: angular print html 
Javascript :: eleventy open browser automatically 
Javascript :: browser support 
Javascript :: node js error 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =