Print all attributes and values in a Javascript Object

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

 

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

原文地址:https://www.cnblogs.com/time-is-life/p/9328666.html