i got object like this.
Object {
"company": "984",
"id": "1",
}
i want to access company and id individually.
The result should look like this
"984"
"1"
How can i achieve these?Thanks.
>Solution :
Object.values will give you an array of the values
const obj = {
"company": "984",
"id": "1",
};
console.log(Object.values(obj));
You can of course assign this array to a variable and then access the values individually
const vals = Object.values(obj);
console.log(vals[0]); /// "984"
console.log(vals[1]); /// "1"