function myFunc(){
this.taste = 'yummi';
console.log(this.taste);
console.log(typeof this);//logs object
}
var noNewObj = myFunc();
console.log(typeof noNewObj);//logs undefined
在myFunc中this
關鍵字指新對象是noNewObj,但在函數外部,變量noNewObj被聲明爲沒有新關鍵字的函數,而不是對象,爲什麼?爲什麼聲明變量沒有新關鍵字的變量是未定義的?
myFunc的不把參選的noNewObj – Rex