JavaScript | Modern JavaScript ES6 | Question 3

Last Updated :
Discuss
Comments

What is the result of the following code?

JavaScript
const obj = { a: 1, b: 2 };
const { a, b } = obj;
console.log(a, b);


{ a: 1, b: 2 }

1 2

undefined undefined

Error

Share your thoughts in the comments