javascript object get values code example

Example 1: how read values of object in javascript

var data={"id" : 1, "second" : "abcd"};
$.each(data, function() {
  var key = Object.keys(this)[0];
  var value = this[key];
  //do something with value;
});

Example 2: object to array javascript

Object.values(obj)

Example 3: object values

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

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

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

Example 4: javascript get values from object

Object.values(data)

Example 5: js get all values of object

Object.values(object1)