javascript object values code example
Example 1: object values javascript
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));
Example 2: map through keys javascript
var myObject = { 'a': 1, 'b': 2, 'c': 3 };
Object.keys(myObject).map(function(key, index) {
myObject[key] *= 2;
});
console.log(myObject);
Example 3: js object keys
var myObj = {no:'u',my:'sql'}
var keys = Object.keys(myObj);
Example 4: object values
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));
Example 5: javascript access property values list of objects
let valuesArray = Object.entries(MyObject);
for (let value of valuesArray) {
document.write(value + "<br>");
}
let person = {
name: "Piet",
age: 42
};
Object.keys(person)
Object.values(person)
Object.entries(person)
Example 6: get all entries in object as array hjs
const object1 = {
a: 'somestring',
b: 42
};
for (let [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}