Bada
Bada's Coding

Bada's Coding

If There Is No Property When Destructuring an Object

Bada's photo
Bada
·Aug 2, 2022·

1 min read

An error does not occur, and 'undefined' is assigned.

const obj = {};

const { k } = obj;

console.log(k); // undefined
 
Share this