-4

I need a small Help in JS? i want to access mail_address of this nested object, how will I do it

const data = 
  { members: 
    [ { id           : '7d8c03e88a8386f6453340c1db56'
      , mail_address : 'trial.om'
      , uniqsl       : 'c6cce01'
  } ] }
Mister Jojo
  • 20,093
  • 6
  • 21
  • 40

1 Answers1

2

const data = {
  members: [
   {
    id: '7d8c03e88a8386f6453340c1db56',
    mail_address: 'trial.om',
    uniqsl: 'c6cce01',
    }
   ]
}

console.log(data.members[0].mail_address) // Prints "trail.om" 

members is a array of objects, but it has one single element. You access this element at the index 0.

Louys Patrice Bessette
  • 33,375
  • 6
  • 36
  • 64
Edu Paz
  • 143
  • 1
  • 7