function aa(){ var aaa="123"; } aa(); alert (typeof aa.aaa)=undefined???
為什麼是undefined?為什麼不是string?
aaa是aa的私有變量,外部訪問不到,而且你這樣調用是將aaa當做aa的屬性了,aa又沒有這個屬性當然是undefined
function aa() { var aaa = "123"; return aaa}
aa.aaa = '123';
alert(aa());
alert(typeof aa.aaa)