Thursday, 10 May 2018

javascript - Converting an object to a string

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:





Object { a=1, b=2} // very nice readable output :)
Item: [object Object] // no idea what's inside :(


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...