-6

I have some obj like this...

 tdata: [
    {
      name: 'jims',
      id: '30616'
    },
    {
      name: 'joms',
      id: '38330'
    }
  ]

I want to know how to get any values from this obj

thanks for every answer :)

Jims
  • 3
  • 1
  • [How to JS objects, courtesy of w3schools](https://www.w3schools.com/js/js_objects.asp) – Vivick Jul 20 '18 at 05:14
  • [JavaScript object basics](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Basics) – Gino Mempin Jul 20 '18 at 05:19
  • Possible duplicate of [Safely turning a JSON string into an object](https://stackoverflow.com/questions/45015/safely-turning-a-json-string-into-an-object) – Nathalia Soragge Jul 20 '18 at 06:00

1 Answers1

0

Try the following

var  tdata= [
  {
    name: 'jims',
    id: '30616'
  },
  {
    name: 'joms',
    id: '38330'
  }
]
  
console.log(tdata[0].name);

First, you have to access the object from the array then you can access the properties of that object.

Aayush Sharma
  • 779
  • 4
  • 20