how to print object object in javascript 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 printing object object
require('util').inspect.defaultOptions.depth = null
Example 3: print object in javascript
var person = {name:"John", age:30, city:"New York"};
document.getElementById("demo").innerHTML = person;