Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point how to obtain the values from the Javascript Objects?

Hi Experts

Could you point how to obtain the values from the Javascript  Objects?

Javascript
console.log(Object.values(where));

Open in new window


Produced
User generated image
So, what's needed to obtain these Object's values?

Thanks in advance!
Avatar of Leonidas Dosas
Leonidas Dosas
Flag of Greece image

Propably you have an array within two objects So..
var obj_1={
  name:'Joe',
  surname:'Doe'
};
var obj_2={
  name:'Jane',
  surname:'Dane'
};

var arr=[obj_1,obj_2];
//Get the name og obj_1
console.log(arr[0].name); //output joe
//Get the name of obj_2
console.log(arr[1].name); //oytput Jane
//Target first the array element eg arr[i]
//and then select the property of this selected object

Open in new window

Avatar of Eduardo Fuerte

ASKER

Hi

I couldn't assume nothing inside the objects .

The only information I have is that is Objects...
ASKER CERTIFIED SOLUTION
Avatar of Leonidas Dosas
Leonidas Dosas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Based on what you posted.

This way runs

console.log(Object.values(where)[0]);

Open in new window

img_ee_003_230617.png
Thank you Leonidas!