You can use a simple function :
for (var key in emperor) {
if (emperor.hasOwnProperty(key)) {
console.log(key + " -> " + emperor[key]);
}
}
or write
console.log(emperor.numLegs);
console.log(emperor.name);
Reference: How do I loop through or enumerate a JavaScript object?