var message;
alert(message);
結果 undefined
alert(age);
結果 報錯
alert(typeof(message));
alert(typeof(age));
未初始化的變量和未定義的變量本質上有差別,但實際上我們都對它們執行真正的操作,是以typeof的結果有其邏輯的合理性。
var message;
alert(message);
結果 undefined
alert(age);
結果 報錯
alert(typeof(message));
alert(typeof(age));
未初始化的變量和未定義的變量本質上有差別,但實際上我們都對它們執行真正的操作,是以typeof的結果有其邏輯的合理性。