var rooms = {
bedroom: {
info: "A dusty bed lies sideways in the midle of the room";
north: function () {
//this function returns an error
}
}
};
我不能明白爲什麼這會返回一個意外的標識符簡單的JavaScript,功能
- 編輯 感謝另一個問題
JavaScript中的好的部分,他有
var myObject = {
value: 0;
increment: function (inc) {
this.value += typeof inc === 'number' ? inc : 1;
}
};
和我在做什麼不一樣?
@fxmile - 看起來像書中的錯誤。它是在第28頁(或關閉)?該頁面的[勘誤表中]列出了類似的內容(http://oreilly.com/catalog/errata.csp?isbn=9780596517748)。 – user113716 2010-12-08 21:35:57