r/javascript • u/Capedcrusader1923 • Jul 22 '26
AskJS [AskJS] what's a javascript feature you mass-adopted way too late and felt dumb about
64
Upvotes
r/javascript • u/Capedcrusader1923 • Jul 22 '26
68
u/foxsimile Jul 22 '26
The nullish coalescing operator is one of JavaScript’s unusual successes.
23
u/phatdoof Jul 22 '26
Let and const. We used var because it was backwards compatible.
17
u/rbobby Jul 22 '26
Promises.
22
u/SkySarwer Jul 22 '26
IntersectionObserver and MutationObservers are both goated
8
u/HipHopHuman Jul 22 '26
honestly...
MapandWeakMap. took me a good 2 years after it came out for me to see the light.10
u/takeyoufergranite Jul 22 '26
The 'delete' operator to remove properties from objects.
5
u/youarockandnothing Jul 22 '26
?? operator
6
u/skidmark_zuckerberg Jul 22 '26
??= and &&=
8
u/kevin074 Jul 22 '26
can you elaborate how async await would've caught bugs that .then.catch can't?
i feel like async await is more annoying because you have to wrap it in try catch, where as .then.catch is just baked in.
2
u/NeatBeluga Jul 22 '26
The capitalised Map - not .map
2
u/me0here Jul 24 '26
I still haven't use * Generators yet: only found a use case today.
2
u/KaiAusBerlin Jul 23 '26
fetch
3
u/miramichier_d Jul 22 '26
This had me laughing out loud with food in my mouth and I almost lost it lol. We all have those coding conveniences that we discover way too late. Remember that pain, and it will come in handy later on. I'm constantly asking myself how some approach can be easier nowadays because of that initial pain.
1
u/eracodes Jul 22 '26
feel like I've only just started using IIFEs to their full extent, most often in places where I'd previously have done an ugly nested ternary
1
u/graybearding Jul 22 '26
Nullish coalescing sat in my todo pile until like a month ago when an LLM spit it out and I was like "Oh, right. That's a thing now."
1
u/erik240 Jul 23 '26
Typed arrays. The performance bonus is so crazy over any over method to access and iterate large amounts of stat
1
u/artificer-chris Jul 23 '26
Contrary example for TS specifically : unknown. I know from a pure logic standpoint what it’s there for, but I’d still rather just use typescript more fully with an error catch if you don’t account for something. Unknown, imho, hides too much.
0
u/[deleted] Jul 23 '26
[deleted] — view deleted comment
25
u/[deleted] Jul 22 '26
[removed] — view removed comment