关于this指向

var c = {

    name: 'The c object',

    log: function() {


        this.name = 'Updated c object';

        console.log(this);


        var setname = function(newname) {

            this.name = newname;

            console.log(this);

        }

        setname('Updated again! The c object');

        console.log(this);

    }

}


c.log();

第二个console.log为什么是指向window???

繁花不似锦
浏览 519回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript