js get all items in onject code example
Example 1: javascript access property values list of objects
// Access all properties and values in a JS object:
let valuesArray = Object.entries(MyObject);
for (let value of valuesArray) {
document.write(value + "<br>"); // value is the property,value pair
}
let person = {
name: "Piet",
age: 42
};
Object.keys(person) // = ["name", "age"]
Object.values(person) // = ["Piet", 42]
Object.entries(person) // = [ ["name","Piet"], ["age",42] ]
Example 2: javascript list object properties
var person={"first_name":"Bill","last_name":"Jenner"}
//get the person object properties with:
var keys = Object.keys(person); //keys = ["first_name","last_name"]