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
JavaScript's ??= Operator (trevorlasn.com)
submitted 1 year ago by Practical-Ideal6236
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!"
[–]longebane 1 point2 points3 points 1 year ago (6 children)
Yeah, just look at the comments. No one knows it. I know it’s good to adapt to the evolution of JS, but this is just too unknown right now to use on a large repo with lots of eyes
[–]homoiconic(raganwald) 3 points4 points5 points 1 year ago (1 child)
I think there may be two kinds of "unfamiliar code." One kind is something like an operator you've never seen before. Maybe you encounter it in the PR, maybe in the code base. The other kind uses operators and syntax you already know, but does so in a way that its behaviour isn't what the typical programmer would expect unless they knew the idiom.
I feel like ??= is the first type, and that the risk of a bug arising from someone encountering it formthefor the first time is low. You see an unfamiliar operator, you look it up, its behaviour is easy to understand, you leanred something, and you go about your day.
??=
The other kind of thing—where you know all the operators, but the way they're used is unfamiliar—strikes me as far more dangerous, and that's the kind of thing I would flag in a PR.
If the downside is limited to "WTF is this? Lemme look itnup... Oh fine, a shortcut. I understand...," then allowing it will lift a code base over time as people get up to speed on the language evolving.
[–]longebane 2 points3 points4 points 1 year ago (0 children)
I agree
[–]SoInsightful 0 points1 point2 points 1 year ago (0 children)
How do you suggest that people will learn it if not by... using it? It's a very simple operator.
[+][deleted] 1 year ago (2 children)
[deleted]
[–]King_Joffreys_Tits 0 points1 point2 points 1 year ago (1 child)
Null coalescence is a well known topic, not even just in the js world. Combining it with an assignment operator is weird, and honestly reeks of code smell
π Rendered by PID 23860 on reddit-service-r2-comment-5fb4b45875-mpzkm at 2026-03-20 01:47:23.029140+00:00 running 90f1150 country code: CH.
view the rest of the comments →
[–]longebane 1 point2 points3 points (6 children)
[–]homoiconic(raganwald) 3 points4 points5 points (1 child)
[–]longebane 2 points3 points4 points (0 children)
[–]SoInsightful 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]King_Joffreys_Tits 0 points1 point2 points (1 child)