After running the following code snippet, I observed that "typeof object[key]" is displaying as a number while "typeof object.key" is showing undefined. Can anyone explain why this unusual behavior is occurring?
var object = {a:3,b:4};
for (var key in object){
console.log(typeof object[key], typeof object.key);
}