js 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: javascript object entries
const object1 = {
a: 'somestring',
b: 42
}
Object.entries(object1)
.forEach(([key, value]) => console.log(`${key}: ${value}`))
Example 4: object to array javascript
Object.values(obj)
Example 5: js object keys
var myObj = {no:'u',my:'sql'}
var keys = Object.keys(myObj);
Example 6: object values
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));