问题:
How can I convert a JavaScript object into a string? 如何将JavaScript对象转换为字符串?
Example: 例:
var o = {a:1, b:2}
console.log(o)
console.log('Item: ' + o)
Output: 输出:
Object { a=1, b=2} // very nice readable output :) 对象{a = 1,b = 2} //非常好的可读输出:)
Item: [object Object] // no idea what's inside :( Item:[object Object] //不知道里面是什么:(
解决方案:
参考一: https://stackoom.com/question/NY8p/将对象转换为字符串参考二: https://oldbug.net/q/NY8p/Converting-an-object-to-a-string
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4318291