1// Access all properties and values in a JS object:
2let valuesArray = Object.entries(MyObject);
3
4 for (let value of valuesArray) {
5 document.write(value + "<br>"); // value is the property,value pair
6 }
7/* Result: propName,value
8 propName,value
9 ...
10
11For clarity: */
12let person = {
13 name: "Piet",
14 age: 42
15};
16
17Object.keys(person) // = ["name", "age"]
18Object.values(person) // = ["Piet", 42]
19Object.entries(person) // = [ ["name","Piet"], ["age",42] ]
20