var obj = {
prop: 'I\'m a property',
meth: function () {
return 'I\'m a method'
}
};
var complexObj = {
prop2: 'I\'m another property',
meth2: function () {
return 'I\'m another method'
}
};
Object.setPrototypeOf(complexObj, obj);
console.log('obj');
console.log('for (var i in obj) {');
for (var i in obj) {
console.log(' i: ', i);
console.log(' obj.hasOwnProperty(i): ', obj.hasOwnProperty(i));
console.log(' i in obj: ', i in obj);
console.log(' obj[i]: ', obj[i]);
console.log('');
}
console.log('}');
console.log('');
console.log('');
console.log('complexObj');
console.log('for (var key in complexObj) {');
for (var i in complexObj) {
console.log(' i: ', i);
console.log(' complexObj.hasOwnProperty(i): ', complexObj.hasOwnProperty(i));
console.log(' i in complexObj: ', i in complexObj);
console.log(' complexObj[i]: ', complexObj[i]);
console.log('');
}
console.log('}');