'next' 是保留的 Javascript 标识符吗?当键为“下一个”时,我的以下代码默默地失败(在 FF 3 中)创建对象的键/值对。但是,当我将键从 prev/next 切换到 navPrev 和 navNext 时,对象会按预期构建。
var unimplementedNavEvent = function() {console.log('Un-implemented Page Navigation Event')};
var navigationEventStubs = [];
for (var i=0, n=pages.length; i<n; i++) {
var pageNavEvents = {href: pages[i], navEvents: {}};
if (i !== 0) {
pageNavEvents.navEvents.prev = unimplementedNavEvent;
}
if (i < n-1) {
pageNavEvents.navEvents.next = unimplementedNavEvent;
}
navigationEventStubs.push(pageNavEvents);
}