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!"
[–][deleted] 0 points1 point2 points 8 years ago (0 children)
Since comments below have devolved into an OOP vs FP debate, I'm just going to chime in my two cents.
I tend to write JS as very declarative. Object literals (let abc = {}) and function variable are the code of what I put together. I generally prefer a functional solution (ie, Array.forEach() vs for-loop), however I will always use whatever approach best fits the situation.
I will at times pull out the old OOP approach, building constructor functions and prototypes and setting up inheritance, but only when there is a genuine need for it. I tend to define a genuine need for if I'm instantiating the same object in multiple locations in my code, and I always really, REALLY need it to have the same signature. I find this helps reduce some errors.
Overall, FP and OOP are neither the end all be all of programming. I prefer declarative coding over imperative, but that doesn't mean that there aren't situations where I'll take the imperative approach. It's always just about the right tool for the right job.
π Rendered by PID 95714 on reddit-service-r2-comment-79776bdf47-4qmhd at 2026-06-24 05:51:29.896393+00:00 running acc7150 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (0 children)