get all values from object javascript code example
Example 1: how to get all values from object in javascript
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));
> Array ["somestring", 42, false]
Object.values(obj)
Example 2: object values
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));
Example 3: javascript access property values list of objects
let valuesArray = Object.entries(MyObject);
for (let value of valuesArray) {
document.write(value + "<br>");
}
let person = {
name: "Piet",
age: 42
};
Object.keys(person)
Object.values(person)
Object.entries(person)
Example 4: js get all values of object
Object.values(object1)