how to 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: cosnsole.log without obj object

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

Example 4: how to log something in the console. javascript

console.log('https://discord.gg/5yjWgMS');