When iterate through an object, reference value by using obj.key all get "undefined" while obj[key] works fine. They are supposed to be equivalent aren't they? Am I missing something?
jsfiddle link: http://jsfiddle.net/nLLcawcn/4/
function iterateObj(obj, callback) {
    if (obj == null || typeof obj != "object") {
        return;
    }
    for (var key in obj) {
        // callback(key, obj[key]);
        console.log("obj.key--->" + obj.key);
        console.log("obj[key]--->" + obj[key]);
        // callback(key, obj.key);
    }
}
var sample = {
    start: "bar",
    notes: [{
        location: "somewhere"
    }, {
        time: "someday"
    }],
    anotherobj: {
        another: "1",
        another1: "3",
        another2: "2"
    },
    end: "foo"
}
iterateObj(sample, function (key, value) {
    // console.log("key: " + key+ ", " + "value: "+ value);
})
 
    