Patternite Logo

Object destructuring in JavaScript

0

Some simple, commonly used patterns for destructuring JavaScript objects

Loading...

JavaScript object destructuring is a cleaner way to accomplish common patterns that involve assigning variables to object values individually, such as the following anti-pattern:

const propertyOne = myObject.propertyOne
const propertyTwo = myObject.propertyTwo
const propertyThree = myObject.propertyThree

The MDN docs have a very thorough overview of object (and array) destructuring.

Profile picture for duncster

| edited

Patternite © 2021

Patternite Logo