javascript object entrie code example
Example 1: javascript object entries
// Object Entries returns object as Array of [key,value] Array
const object1 = {
a: 'somestring',
b: 42
}
Object.entries(object1) // Array(2) [["a", "something"], ["b", 42]]
.forEach(([key, value]) => console.log(`${key}: ${value}`))
// "a: somestring"
// "b: 42"
Example 2: object.keys javascript
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));