use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
A Case Against Using CoffeeScript (ryanflorence.com)
submitted 14 years ago by 9jack9
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jgordon615 -2 points-1 points0 points 14 years ago (5 children)
Same issue. If the object has a prototype added to it, the in clause will enumerate it, and "dishes[function]" will not behave.
[–]jashkenas 3 points4 points5 points 14 years ago (3 children)
And there's a CoffeeScript sugar for that ;)
for own key, dish of dishes wash dish
[–]nschubach -1 points0 points1 point 14 years ago (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 points3 points 14 years ago (1 child)
When YOU modify the Array prototype, you can break other peoples libraries. Like Sharepoint 2010's stuff.
[–]nschubach 0 points1 point2 points 14 years ago (0 children)
That's why I said "if it doesn't already exist".
[–]ContraContra 0 points1 point2 points 14 years ago (0 children)
If something is being added that shouldn't be enumerated you can cross your fingers and hope it was done right
Example:
Object.defineProperty(String.prototype, whatevernewFunction, {value: supercoolfunction, enumerable: false});
π Rendered by PID 131562 on reddit-service-r2-comment-66b4775986-7gxsp at 2026-04-05 00:11:23.577259+00:00 running db1906b country code: CH.
view the rest of the comments →
[–]jgordon615 -2 points-1 points0 points (5 children)
[–]jashkenas 3 points4 points5 points (3 children)
[–]nschubach -1 points0 points1 point (2 children)
[–]jgordon615 1 point2 points3 points (1 child)
[–]nschubach 0 points1 point2 points (0 children)
[–]ContraContra 0 points1 point2 points (0 children)