swati-jagtap / javascript-practice

0 stars 0 forks source link

11.2.1--Iterate through the users array and get all the keys of the object using destructuring #138

Open swati-jagtap opened 3 years ago

swati-jagtap commented 3 years ago
const users = [
{
  name:'Brook',
  scores:75,
  skills:['HTM', 'CSS', 'JS'],
  age:16
},
{
  name:'Alex',
  scores:80,
  skills:['HTM', 'CSS', 'JS'],
  age:18
},
{
  name:'David',
  scores:75,
  skills:['HTM', 'CSS'],
  age:22
},
{
  name:'John',
  scores:85,
  skills:['HTML'],
  age:25
},
{
  name:'Sara',
  scores:95,
  skills:['HTM', 'CSS', 'JS'],
  age: 26
},
{
  name:'Martha',
  scores:80,
  skills:['HTM', 'CSS', 'JS'],
  age:18
},
{
  name:'Thomas',
  scores:90,
  skills:['HTM', 'CSS', 'JS'],
  age:20
}
]

//11.2.1--Iterate through the users array and get all the keys of the object using destructuring
for(const {name,scores,skills,age} of users)
{   

     console.log(name,scores,skills,age)
}

image