r/learnjavascript • • Feb 16 '21

Javascript Object Merge

Post image
183 Upvotes

28 comments sorted by

View all comments

2

u/192_168_1_x Feb 17 '21

What’s the ?? operator?

return a ?? {}

4

u/beforesemicolon Feb 17 '21

Thats the null coalescing operator. It picks the right side value if the left side is either null or undefined.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator

1

u/192_168_1_x Feb 17 '21

new syntax, cool. TIL thanks.

1

u/[deleted] Feb 17 '21

You're welcome.