How can I convert a JavaScript object into a string?
Example:
var o = {a:1, b:2} console.log(o) console.log(\'Item: \' + o)
Output:
There is actually one easy option (for recent browsers and Node.js) missing in the existing answers:
console.log('Item: %o', o);
I would prefer this as JSON.stringify() has certain limitations (e.g. with circular structures).
JSON.stringify()