-5

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
  • 16,804
  • 3
  • 16
  • 39

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
  • 31,534
  • 6
  • 35
  • 61
Edu Paz
  • 43
  • 5