javascript object value code example
Example 1: object values javascript
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));
Example 2: javascript object to array
fooArray = Object.entries(fooObj);
fooArray.forEach(([key, value]) => {
console.log(key);
console.log(value);
})
Example 3: js object keys
var myObj = {no:'u',my:'sql'}
var keys = Object.keys(myObj);
Example 4: js get all values of object
Object.values(object1)
Example 5: js create object with properties
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}