javascript array loop all keys in an object code example
Example 1: loop key in object
const fruits = { apple: 28, orange: 17 }
for(key in fruits){
console.log(key)
}
Example 2: javascript loop through object values
var myObj = {foo: "bar", baz: "baz"};
Object.values(myObj).map((val) => {
console.log(val);
})
// "bar" "baz"