正在創建'類對象'嗎?如果這是正確的術語。爲什麼存儲在Object中的函數在運行結束時在控制檯中返回undefined?
var cat = {
eyes:2,
pur: function() {
console.log("puuuuurrrrr");
}
};
cat.pur();
在Chrome中,返回console.log消息,然後在下一行中定義爲undefined。想知道是什麼導致未定義在最後彈出。當我打電話給cat.eyes時,它不會這樣做。在Internet Explorer中,發生在console.log()事件之前。在nodeJS中,這發生在console.log之後。
因爲沒有從'pur()'返回 – Tushar