16.
What is destructuring assignment in JavaScript ES6?
It is a method to assign multiple variables to a single value.
It is a feature that allows renaming variables.
It is a method to delete default values from variables in JavaScript.
It is a way to unpack values from arrays or properties from objects into distinct variables.
Correct: D
Destructuring assignment allows us to extract and assign values from arrays or objects into separate variables, making it easier to work with complex data structures. It can be used with arrays, objects, and function parameters.
const person = {
name: "Alice",
age: 28,
city: "New York",
};
const { name, age, city } = person;
console.log(name); // "Alice"
console.log(age); // 28
console.log(city); // "New York"