for loop to read keys in object javascript code example
Example 1: javascript looping through object
const fruits = {
apple: 28,
orange: 17,
pear: 54,
}
const entries = Object.entries(fruits)
console.log(entries)
// [
// [apple, 28],
// [orange, 17],
// [pear, 54]
// ]
Example 2: loop though json object in javascript
var p = {
"p1": "value1",
"p2": "value2",
"p3": "value3"
};