下面的代碼將輸出到控制檯的是什麼,爲何?

(function(){ var a = b = 3; })(); console.log("a defined? " + (typeof a !== 'undefined')); console.log("b defined? " + (typeof b !== 'undefined')); 因爲a和b都在函數的封閉範圍內定義,而且因爲它們所在的行以var關鍵字開頭,所以大多數JavaSc
相關文章
相關標籤/搜索