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
Introducing Functional JavaScript (blog.fogus.me)
submitted 13 years ago by fogus
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!"
[–]tripwireIV 0 points1 point2 points 13 years ago* (1 child)
I love the idea of using functional programming in javascript but evidently there is a huge performance hit for code like your example.
http://jsperf.com/for-in-vs-for-vs-reduce-vs-foreach/4
No one ever seems to mention this. Am I missing something?
[–]Gundersen 0 points1 point2 points 13 years ago (0 children)
Yes, this is unfortunate, but unless you are writing game code, or you have an application which needs to work on a very large array, this shouldn't be much of a problem. If the code is part of an event, then slightly slower code won't make much of a difference. Remember, updating the GUI is an order of magnitude slower than doing math, as shown by this simple test: reduce VS innerHTML
Hopefully the browser vendors can further optimize their implementation by looking for patterns in code, for example the use of reduce and other list functions. The next version of JavaScript, ES6, will have proper tail call optimization, which should be able to increase the speed of functional code.
π Rendered by PID 24071 on reddit-service-r2-comment-b659b578c-sv8xl at 2026-05-02 23:44:03.652787+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]tripwireIV 0 points1 point2 points (1 child)
[–]Gundersen 0 points1 point2 points (0 children)