pkmnq — 9/20/2022, 3:29:09 AM

i mean, just its name is cool enough, “Nullish Coalescing”

↩ repost
gilbert189 — 9/19/2022, 8:53:50 AM

javascript’s ?? is cool

♥ 3 ↩ 1 💬 0 comments
♥ 2 ↩ 0 💬 5 comments

comments

lily:

what does that do

9/20/2022, 7:28:43 AM
gilbert189:

Here’s an example:

> 1 ?? 0
1
> undefined ?? 0
0
> bork ?? 0 // bork is not defined
0
9/20/2022, 7:34:32 AM
gilbert189:

wait, the last one isn’t correct, I think I’ve confused it with an object :P

9/20/2022, 7:38:35 AM
pkmnq:

return the left argument, unless the left argument is undefined or null, in which case return the right argument

9/20/2022, 12:17:58 PM
lily:

ah cool

9/20/2022, 12:54:29 PM