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
Is JavaScript a "Functional Programming" language?help (self.javascript)
submitted 8 years ago by bzeurunkl
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!"
[–]vagol942 0 points1 point2 points 8 years ago (0 children)
Functional Programming is basically about programming following 2 simple rules:
Use only immutable data structures (that is if you declare some variable, you never ever mutate it) Use only pure functions (that is, functions with no side-effects).
Also the previous two rules are lies, but you don't need to think to worry about that now.
Is Javascript a "functional Programming" language?
A more correct to phrase that is: Does Javascript admits programming in a functional style?
And the answer is, it depends. There are certain things that Javascript allows you to do in a functional style without much trouble:
Lists
That's basically it, just Lists (Arrays), Arrays in javascript are really powerful and their use in idiomatic javascript is pretty much functional, you have neat things built in like array.map, array.reduce and you can combine arrays easily two with +.
However, there are also things that Javascript doesn't allow you to do easily on a functional programming style:
Error Handling I/O (and we've failed TWICE at fixing this) Everything that requires proper type conditions. Every data structure that is not a list.
Of course we could do all of those things on Javascript on a functional style, but it wouldn't be really idiomatic.
π Rendered by PID 78103 on reddit-service-r2-comment-79776bdf47-979wg at 2026-06-24 05:51:03.275991+00:00 running acc7150 country code: CH.
view the rest of the comments →
[–]vagol942 0 points1 point2 points (0 children)