Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

destructuring an object js

const user = { id: 42, isVerified: true }

// grabs the property by name in the object, ignores the order
const { isVerified, id } = user;

console.log(isVerified);
// > true
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #destructuring #object #js
ADD COMMENT
Topic
Name
8+9 =