values of object javascript code example

Example 1: object values javascript

const object1 = {
  a: 'somestring',
  b: 42,
  c: false
};

console.log(Object.values(object1));
// expected output: Array ["somestring", 42, false]

Example 2: object values

const object1 = {
  a: 'somestring',
  b: 42,
  c: false
};

console.log(Object.values(object1));

// expected output: Array ["somestring", 42, false]

Example 3: Object.Values () javascript

const object1 = {
  a:"somestring",
  b: 42,
  c: false,
  d: function test()
};

console.log(Object.values(object1));
// expected output: Array ["somestring", 42, false, function test()]
const object2 = "test";
console.log(Object.values(object2));
// expected output: Array ["t","e","s","t"]

Tags:

Css Example