javascript console.log object code example

Example 1: print object javascript

str = JSON.stringify(obj);
str = JSON.stringify(obj, null, 4); // (Optional) beautiful indented output.
console.log(str); // Logs output to dev tools console.
alert(str); // Displays output using window.alert()

Example 2: 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 3: console.log javascript

console.log(10);
console.log('You can also log numbers')

Example 4: cosnsole.log without obj object

console.log(JSON.stringify(myObject, null, 4));

Example 5: javascript console.log

console.log('I want to log this so I am logging this. Calm down and log.')

Example 6: console log javascript

console.log("hello", value);