rafaelmaeuer
1/6/2018 - 4:32 PM

How can I display a JavaScript object?

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()