按照我的理解console
应该是window
对象下的一个对象console
对象下又有一个log
方法(函数)
那按照this
的定义:在函数中使用this
,当函数被作为某个对象的方法调用时,this
等于那个对象
调用this
的是console
对象 this
应该指的是console
对象 为什么出来的是window对象呢
在console.log
这个函数体里面,this
才是console
,你这段程序分明就在这个函数外面……
console.log(this) //这个this 是传入log的参数,此时this指向window,比如在控制台窗口
函数体内的this才指向console