print value of 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: print object in javascript
var person = {name:"John", age:30, city:"New York"};
document.getElementById("demo").innerHTML = person;