Print all attributes and values in a Javascript Object

function printObject(o) {
var out = '';
for (var p in o) {
out += '\n' + ':: ' + p + '(' + typeof(o[p]) + ') ::' + '\n' + o[p] + '\n';
}
console.log(out);
}

 

来自: https://gist.github.com/okor/1536669 

猜你喜欢

转载自www.cnblogs.com/time-is-life/p/9328666.html