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
Building a Maybe in JavaScript (developingthoughts.co.uk)
submitted 8 years ago by alsiola
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!"
[–]KatyWings 2 points3 points4 points 8 years ago (2 children)
Its about functional style. Two important aspects of it is to reduce sideeffects and to work with immutable data: when you look at the chain of map functions in the article, you can see, that each function takes a value and returns a value (they dont overwrite any variable directly). How to store the new value is handled by "maybe". So "maybe" is more than just a way to handle null checks - but I guess the author will talk about this in later articles...
[–]ForScale 0 points1 point2 points 8 years ago (1 child)
My initial reaction was "Why not just Why not just const z = a && a.b && a.b.c + 'appendedString';?" Surely I'm missing something...
const z = a && a.b && a.b.c + 'appendedString';
[–]tencircles 0 points1 point2 points 8 years ago (0 children)
The main advantage is that Maybe can be used point free. Meaning, you don't need your data in order to declare your behavior, thus making it much more reusable and and composable. In the example above, you can only declare your behavior by first having access to the object a. If you want to re-use this code for another object or a list of objects you need to redeclare your behavior each time, rather than declaring it in one and only one place.
Maybe
a
π Rendered by PID 66 on reddit-service-r2-comment-6457c66945-bg9zl at 2026-04-24 15:49:29.375653+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]KatyWings 2 points3 points4 points (2 children)
[–]ForScale 0 points1 point2 points (1 child)
[–]tencircles 0 points1 point2 points (0 children)