javascript - For-of loop in node --harmony doesn't work with arrays -


When I start node v0.11.14 REPL with the option of - good faith and loop Try, I get:

  & gt; (Var i [3, 4, 5]) console.log (i); TypeError: Undefined is not a function  

is the same for the set but it works fine with the generator:

  & gt; Function * Counter () {var n = 3; While (N & lt; 7) {yield n ++; }} & Gt; Var c = new counter (); & Gt; For (var i's c) console.log (i); Although its first example is:  
 for  (["one", "two", "three"] words) {Warning (word); }  

and include the same example. I have failed in Google for "in node" should I actually work in node or am I forgetting something?

for and iterated objects were applied separately in v8 I went. It seems that in v8 the node is bundled with 0.11.14, you can use it only with the generator.

You can check the obj [Symbol.iterator] property to see if the object is iterable, it should be a function. Construction with v8 in my node 3.29.93 Everything works as expected, so you probably have to wait for the next 0.11 release (or 0.12).


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -