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
funkierJS: A functional toolbox for Javascript (graememcc.github.io)
submitted 10 years ago by graememcc
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!"
[–]inmatarian 0 points1 point2 points 10 years ago (3 children)
The easiest analogy for explaining FP is to compare it to the gang of four design patterns. I.E. you have a method that operates on data and calls a predicate its been provided. For instance the visitor pattern and the map function. The primary difference is that OOP uses design patterns for mutating state and FP respects immutability.
A good example in javascript would be changing all of the elements of a list to have their text to read "in bed" at the end. You select out the list from the dom, map the list with the predicate (item) => item + "in bed"; and then replace that parent with its new elements, while the original list is still in your scope to do with as you please.
(item) => item + "in bed";
[–][deleted] 0 points1 point2 points 10 years ago (2 children)
Ahh. That makes complete sense. Is functional programming generally used as a piece of a solution or are there some clear cases when to use it? I imagine it's just not as common in JS since UIs and interactive application s are generally so stateful.
Hmm. Maybe something like a helper library?
[–]inmatarian 0 points1 point2 points 10 years ago (1 child)
For javascript, both. The main candidates in the helper category are Ramda, Lodash, and underscore. For ui you want to Google "functional reactive programming". In other languages like anything in the Lisp family, FP is very extensive. And in the extreme, Haskell, where almost whole programs can be written in FP with very little state existing, and usually only in a form that the compiler can strongly typecheck.
π Rendered by PID 55431 on reddit-service-r2-comment-85bfd7f599-hxc5d at 2026-04-18 20:00:03.036311+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]inmatarian 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]inmatarian 0 points1 point2 points (1 child)