In Firefox 72, we'll ship the Nullish Coalescing Operator, allowing developers to easily test for values that may be falsy, but are not null or undefined. It will be available in the next Nightly. The proposal is in stage 3, and has been added to the agenda for December 2019 to go to stage 4.
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1566141 Standard: https://tc39.es/proposal-nullish-coalescing/ Platform coverage: All, no pref DevTools bug: N/A. Other browsers: Intent to ship in Chrome for desktop release 80 <https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/v8$20nullish%7Csort:date/blink-dev/7zLAOqxWxbE/IFifZv0gEAAJ>, In Safari technology preview 89 <https://webkit.org/blog/9497/release-notes-for-safari-technology-preview-89/)>. Testing: There are test262 tests covering this feature: https://github.com/tc39/test262/tree/master/test/language/expressions/coalesce Use cases: The nullish coalescing operator is useful for testing for values that may have been set to a falsy value, where that falsy value is intentional and valid. For example, the following two expressions are equivalent: `a ?? b` and `a !== undefined && a !== null ? a : b`. Secure contexts: This is a JS language feature and is therefore present in all contexts. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform