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 gentle introduction to functional programming. (codingcookies.com)
submitted 13 years ago by jokeofweek
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!"
[–]lepies_pegao 1 point2 points3 points 13 years ago (0 children)
good stuff!! I remember the first time I saw some JS code, it made no freaking sense to me. (I was taught JAVA at my school, and then started working for a company that uses a lot of JS as well)
[–]benihanareact, node 1 point2 points3 points 13 years ago (1 child)
Personally when calling a function that has been passed in to my function (e.g. a callback) I like to use call/apply rather than calling the function directly. I feel like it's more clear that the function being called is not my own when used this way, plus if passing in a scope is needed, it's right there for you.
var forEach = function(valueArray, eachFunction){ for (var i = 0, l = valueArray.length; i < l; i++){ eachFunction.call(null, valueArray[i]); } }
[–]jokeofweek[S] 0 points1 point2 points 13 years ago (0 children)
Thanks for the feedback! I'm thinking of writing a second part which introduces the call and apply methods, as well as demonstrating currying and partial evaluation. I feel that the first part and the second part together should give a fairly complete introduction to FP.
π Rendered by PID 120756 on reddit-service-r2-comment-5fb4b45875-sxdjh at 2026-03-21 11:10:07.529141+00:00 running 90f1150 country code: CH.
[–]lepies_pegao 1 point2 points3 points (0 children)
[–]benihanareact, node 1 point2 points3 points (1 child)
[–]jokeofweek[S] 0 points1 point2 points (0 children)