Skip to content Skip to sidebar Skip to footer

Access Object Properties In Javascript

I am trying to access email and password field but i dont know where this '0' came. I am retrieving object from rethinkdb and it looks good without '0'. But then am using Lodash _

Solution 1:

You can access like this,

user['0'].email

or

user['0']['email']

Solution 2:

you are retrieving array of data from database. That's how the 0 is coming. There should be a .first() method on db query or ORM you are using which will return single object of user not array.

Post a Comment for "Access Object Properties In Javascript"