Volevo utilizzare for each ... in
con Node.js (v0.4.11).Node.js: per ogni ... non funziona
lo uso così:
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);
}
ottengo il seguente errore:
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)
Dov'è l'errore? for each ... in
è supportato da Javascript 1.6.
Vedi MDN per informazioni sull'uso di for each ... in
.
V8 implementa ECMAScript. I documenti MDN mostrano 'Versione ECMA: nessuna' – user113716