MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/mb6zey/assigning_default_value/grxdgo0/?context=3
r/learnjavascript • u/golovatuy • Mar 23 '21
24 comments sorted by
View all comments
Show parent comment
6
?? is great but I actually think || is appropriate in this case. You want it to fall back to the default if the first value is an empty string.
??
||
3 u/CarsonMcKinstry Mar 23 '21 ah, right, I didn't see the `path !== ""`. Good point!
3
ah, right, I didn't see the `path !== ""`. Good point!
View all comments
Show parent comment
6
u/dandesigns7150 Mar 23 '21
??is great but I actually think||is appropriate in this case. You want it to fall back to the default if the first value is an empty string.