On 2011-12-05 16:47, Adam Ruppe wrote:
Jacob Carlborg Wrote:
for e in arr
      # do something with the element "e"

Heh, I used to think that would work in regular Javascript,
since it does have a for(blah in something) form...

But in regular javascript, that only works on objects!

Yeah, it's very annoying. CoffeeScript also has the following iteration syntax:

for key, value of obj
    # do something with key and value

Which compiles to:

for (k in obj) {
  v = obj[k];
}

--
/Jacob Carlborg

Reply via email to