🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Destructuring
Destructuring - JavaScript - MDN Web Docs
The destructuring syntax is a JavaScript syntax that makes it possible to unpack values from arrays, or properties from objects, into distinct variables. It can be used in locations that receive data (such as the left-hand side of an assignment or anywhere that creates new identifier bindings).
🌐
W3Schools
w3schools.com › JS › js_destructuring.asp
JavaScript Destructuring
JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate ... // Create an Object const person = { firstName: "John", lastName: "Doe", age: 50 }; // Destructuring let {firstName, lastName} = person; Try it Yourself »
Discussions

Help Understanding Object Destructuring in JavaScript
This is semantically no different than the following: const name = person.name; const age = person.age; const anotherName = person.anotherName; //doesnt exist on person const anotherAge person.anotherAge; //also doesnt exist person Since there is no key "anotherName" or "anotherAge" on the person object, so they resolve to undefined. The name of the variables have to match the key on the object being destructured. More on reddit.com
🌐 r/learnjavascript
20
20
August 25, 2024
Destructuring props in typescript
Because this: {userDetails}: { userDetails: UserInformation} ...is declaring the destructured variable "userDetails" as type "UserInformation," while this: { userDetails: UserInformation} ...is destructuring "userDetails" and renaming it to "UserInformation" without explicitly declaring its type. More on reddit.com
🌐 r/react
14
5
January 21, 2024
Why is function parameter destructuring so bad in TypeScript?
GitHub issue on this topic: https://github.com/Microsoft/TypeScript/issues/7576 More on reddit.com
🌐 r/typescript
11
1
May 24, 2023
Best way for destructuring props in React
First method is preffered and widely used in real development. More on reddit.com
🌐 r/reactjs
11
2
April 18, 2023
🌐
DEV Community
dev.to › dianakw8591 › object-destructuring-in-javascript-482k
Object Destructuring in JavaScript - DEV Community
August 14, 2020 - Note that with bracket notation, ... to be a variable in that case. A destructuring assignment allows the mass assignment of variables to object (or array) values....
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-object-destructuring-in-js
JavaScript - Object Destructuring in JS - GeeksforGeeks
Object destructuring is a syntax feature in JavaScript that allows you to extract values from objects and assign them to variables in a more concise and readable way.
Published   November 30, 2024
🌐
freeCodeCamp
freecodecamp.org › news › javascript-object-destructuring-spread-operator-rest-parameter
JavaScript Object Destructuring, Spread Syntax, and the Rest Parameter – A Practical Guide
February 8, 2021 - We can simplify this process using the new object destructuring syntax introduced in ES6. JavaScript Object Destructuring is the syntax for extracting values from an object property and assigning them to a variable.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Destructuring_assignment
Destructuring - JavaScript | MDN
The destructuring syntax is a JavaScript syntax that makes it possible to unpack values from arrays, or properties from objects, into distinct variables. It can be used in locations that receive data (such as the left-hand side of an assignment or anywhere that creates new identifier bindings).
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Destructuring assignment
February 26, 2026 - The function might only require certain elements or properties. Destructuring assignment is a special syntax that allows us to “unpack” arrays or objects into a bunch of variables, as sometimes that’s more convenient.
🌐
Dmitri Pavlutin
dmitripavlutin.com › javascript-object-destructuring
How to Use Object Destructuring in JavaScript - Dmitri Pavlutin
January 28, 2023 - Object destructuring is a useful JavaScript feature to extract properties from objects and bind them to variables. Even better, object destructuring can extract multiple properties in a single statement, can access properties from nested objects, ...
Find elsewhere
🌐
Syncfusion
syncfusion.com › blogs › javascript › top 7 javascript object destructuring techniques
Top 7 JavaScript Object Destructuring Techniques | Syncfusion Blogs
December 19, 2024 - Object destructuring is the process of extracting multiple properties or items from objects at once. This technique is really useful when accessing object properties in JavaScript.
🌐
Educative
educative.io › answers › what-is-object-destructuring-in-javascript
What is object destructuring in JavaScript?
Destructuring allows us to extract multiple properties, or items, from an array​ at a time. The right side of the statement contains the Javascript object that we want to split into variables; the left side contains a “pattern” for the ...
🌐
Medium
medium.com › @ezinneanne › what-is-destructuring-in-javascript-bd441ec5d54f
What is destructuring in JavaScript? | by Ezinne Anne Emilia | Medium
January 10, 2023 - What is destructuring in JavaScript? Destructuring in JavaScript means copying the values of an array or the properties of an object to a variable. Destructuring does not imply destruction. It is not …
🌐
Colt Steele
coltsteele.com › tips › object-destructuring-in-javascript
Object Destructuring in JavaScript | Colt Steele
August 11, 2023 - This function takes a user object, destructures it to get the first name, last name, and the two last digits of the birth year, and then generate the username by concatenating these values. And that's how object destructuring can help us simplify our code and make it more readable. The next time you need to extract multiple properties from an object in JavaScript, try object destructuring to simplify your code and make it more readable.
🌐
Wes Bos
wesbos.com › destructuring-objects
A Dead Simple intro to Destructuring JavaScript Objects - Wes Bos
November 15, 2016 - It's the new destructuring syntax. The above code says, give me a variable called first, a variable called last, and take it from the person object. We're taking the first property and the last property and putting them into two new variables that will be scoped to the parent block (or window!).
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript tutorial › javascript object destructuring
JavaScript Object Destructuring
December 17, 2023 - Summary: in this tutorial, you’ll learn about JavaScript object destructuring which assigns properties of an object to individual variables.
🌐
Greenroots
blog.greenroots.info › javascript-object-destructuring-usages-you-must-know
JavaScript object destructuring usages you must know
May 6, 2025 - Since ES6(ECMAScript 2015), JavaScript provides a mechanism to handle the properties of objects in a much more innovative way. The mechanism is called Destructuring(also known as destructuring assignment).
🌐
freeCodeCamp
freecodecamp.org › news › destructuring-in-javascript
How Destructuring Works in JavaScript – Explained with Code Examples
February 7, 2024 - In this example, { name, address: { city, country } } is the destructuring syntax. You're extracting the name property directly from the person object. Then within the address object, you're extracting the city and country properties. So city will have the value "New York", and country will default to undefined assuming address does not have a country property. That's it! You should now have a good understanding of how JavaScript destructuring works for arrays and objects.
🌐
freeCodeCamp
freecodecamp.org › news › array-vs-object-destructuring-in-javascript
Array vs Object Destructuring in JavaScript – What’s the Difference?
November 10, 2021 - Suppose you prefer to separate ... Let see how. Whenever you use object destructuring, JavaScript allows you to separate your variable declarations from their assignments....
🌐
freeCodeCamp
freecodecamp.org › news › array-and-object-destructuring-in-javascript
How to Use Array and Object Destructuring in JavaScript
April 5, 2020 - By Sarah Chima Atuonwu The destructuring assignment is a cool feature that came along with ES6. Destructuring is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables. That ...
🌐
Reddit
reddit.com › r/learnjavascript › help understanding object destructuring in javascript
r/learnjavascript on Reddit: Help Understanding Object Destructuring in JavaScript
August 25, 2024 -

I'm currently learning JavaScript and practicing some code, but I'm getting a bit confused about how object destructuring works. Below is the code snippet I'm working with:

const person = {
  name: "Harmeet",
  age: 40
}

const { name, age} =  person;

console.log(name); // prints Harmeet
console.log(age); // prints 40

const {anotherName, anotherAge} = person;

console.log(anotherName); // prints undefined
console.log(anotherAge); // prints undefined

Could someone explain how the object destructuring is working in this context? Specifically, I'm confused about during the second time assignment, why object descrtion prints undefined instead of values? Any detailed explanation or examples would be greatly appreciated!

🌐
GeeksforGeeks
geeksforgeeks.org › javascript › destructuring-assignment-in-javascript
Destructuring in JavaScript - GeeksforGeeks
Destructuring Assignment is a JavaScript expression that allows to unpack of values from arrays, or properties from objects, into distinct variables data can be extracted from arrays, objects, and nested objects, and assigned to variables.
Published   November 9, 2024