var myObj = {foo: "bar", baz: "baz"};
Object.values(myObj).map((val) => {
console.log(val);
})
// "bar" "baz"
const object = {a: 1, b: 2, c: 3};
for (const property in object) {
console.log(`${property}: ${object[property]}`);
}
const object1 = {
a: 'somestring',
b: 42
};
for (const [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}
// expected output:
// "a: somestring"
// "b: 42"
for (const value of Object.values(obj)) { }
const population = {
male: 4,
female: 93,
others: 10
};
let numbers = Object.values(population);
console.log(numbers); // [4,93,10]
const person = {
first_name: 'Monica',
last_name: 'Geller',
phone: '915-996-9739',
email: 'monica37@gmail.com',
street: '495 Grove Street',
city: 'New York',
country: 'USA',
};
const values = Object.values(person);
console.log(values);