javascript (was Re: Java > Scala -> new thread: GUI for D)
    Jacob Carlborg 
    doob at me.com
       
    Mon Dec  5 09:46:52 PST 2011
    
    
  
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
    
    
More information about the Digitalmars-d
mailing list