Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Destructuring - Before ES6

// assigning object attributes to variables
const person = {
    name: 'Sara',
    age: 25,
    gender: 'female'    
}

let name = person.name;
let age = person.age;
let gender = person.gender;

console.log(name); // Sara
console.log(age); // 25
console.log(gender); // female
Source by jscomplete.com #
 
PREVIOUS NEXT
Tagged: #JavaScript #Destructuring #Before
ADD COMMENT
Topic
Name
7+6 =