我想使用for each ... in
与Node.js(v0.4.11)。Node.js:对于每个...在不工作
我用这样的:
var conf = {
index: {
path: {
first: "index.html",
pattern: "index/{num}.html"
},
template: "index.tpl",
limit: 8
},
feed: {
path: "feed.xml",
template: "atom.tpl",
limit: 8
}
}
for each (var index in conf) {
console.log(index.path);
}
我得到以下错误:
for each (var index in conf) {
^^^^
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected identifier
at Module._compile (module.js:397:25)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at require (module.js:346:19)
at Object.<anonymous> (/home/paul/dev/indexing/lib/Index.js:3:13)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
哪里错了吗?自Javascript 1.6以来,支持for each ... in
。
有关使用for each ... in
的信息,请参阅MDN。
V8实现ECMAScript。 MDN文档显示'ECMA version:none' – user113716