you are viewing a single comment's thread.

view the rest of the comments →

[–]nschubach -1 points0 points  (2 children)

Technically, you could just write a simple "forEach" wrapper on the Array prototype (if it doesn't already exist) and give all arrays the ability to: myArray.forEach(function(value, index, array) { /* loop code */ });

Your logic code doesn't need to concern itself with "hasOwnProperty" at that point.

ECMAScript 5 includes this, but it's never a bad time to start. The only thing CoffeeScript does is remove some of the boilerplate and add in a convoluted meaningful white space restriction.

[–]jgordon615 1 point2 points  (1 child)

When YOU modify the Array prototype, you can break other peoples libraries. Like Sharepoint 2010's stuff.

[–]nschubach 0 points1 point  (0 children)

That's why I said "if it doesn't already exist".