Enable support for JS stage 4 features#861
Merged
Conversation
Enables support for JS stage 4 features. - [Nullish Coalescing](https://github.com/tc39/proposal-nullish-coalescing) - [Numeric Separator](https://github.com/tc39/proposal-numeric-separator) - [Optional Catch Binding](https://github.com/tc39/proposal-optional-catch-binding) <details> <summary>Nullish Coalescing</summary> ```javascript const response = { settings: { nullValue: null, height: 400, animationDuration: 0, headerText: '', showSplashScreen: false } }; const undefinedValue = response.settings.undefinedValue ?? 'some other default'; // result: 'some other default' const nullValue = response.settings.nullValue ?? 'some other default'; // result: 'some other default' ``` </details> <details> <summary>Numeric Separator</summary> ```javascript 1_000_000_000 // Ah, so a billion 101_475_938.38 // And this is hundreds of millions let fee = 123_00; // $123 (12300 cents, apparently) let fee = 12_300; // $12,300 (woah, that fee!) let amount = 12345_00; // 12,345 (1234500 cents, apparently) let amount = 123_4500; // 123.45 (4-fixed financial) let amount = 1_234_500; // 1,234,500 0.000_001 // 1 millionth 1e10_000 // 10^10000 // Binary let nibbles = 0b1010_0001_1000_0101; // Hex Litral let message = 0xA0_B0_C0; // Octal Literal let x = 0o1234_5670; ``` </details> <details> <summary>Optional Catch Binding</summary> ```javascript try { throwAnException(); } catch { console.log('we do not care about error object here, carry on'); } ``` </details>
mixonic
reviewed
Feb 3, 2021
mixonic
approved these changes
Feb 3, 2021
Co-authored-by: Matthew Beale <matt.beale@addepar.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables support for JS stage 4 features.
Nullish Coalescing
Numeric Separator
Optional Catch Binding