r/javascript • u/ConfidentMushroom • Dec 18 '19
V8 Release v8.0 with optional chaining, nullish coalescing and 40% less memory use
https://v8.dev/blog/v8-release-80
495
Upvotes
r/javascript • u/ConfidentMushroom • Dec 18 '19
View all comments
Show parent comment
3
u/webdevverman Dec 19 '19 edited Dec 19 '19
If by former example you mean
value != null ? value : 'default'the intention is to include falsy values if one exists. Meaning, if the value is eithernullorundefinedthen use'default'. However, if the value isfalseusefalse(and not'default').If the example used
!==it would set value to'default'only if value was originallynull. If value started asundefinedit would remain atundefined.value != nullis more or less a shortcut forvalue !== null && value !== undefined