console log values in an object in javascript code example
Example 1: console.log object object
const language = this.converstaionLanguage; // {"lang":"en"} <- this is JSON
console.log(language); // [object Object]
console.log(JSON.stringify(language) // {"lang":"en"}
Example 2: 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}`);
}
// expected output:
// "a: somestring"
// "b: 42"
// order is not guaranteed