EN
JavaScript - print object in console
12
points
In this article, we would like to show you how to print object in console in JavaScript.
Quick solution:
// ONLINE-RUNNER:browser;
var object = { id: 2, name: 'Tom', age: 25 };
console.log(JSON.stringify(object)); // compressed printing
console.log(JSON.stringify(object, null, 4)); // beauty printing