On 2011-12-05 16:53, Adam Ruppe wrote:
Marco Leise Wrote:
This is really one of the largest shortcomings of the language that can
not be explained with a simple design choice.

Aye. One of the newer versions adds a forEach member to the
array prototype, that works like this:

[1, 2, 3].forEach(function(element) { use element here; });

but I don't like that style, personally. All those years of C
and friends have wired my brain to see it as being backward.

And, it doesn't work for everyone out of the box anyway.

That's the Ruby style, quite verbose in plain JavaScript. In CoffeeScript it would look like:

[1, 2, 4].forEach (element) -> # use element here

--
/Jacob Carlborg

Reply via email to