You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the main reason I would like to see this added great that @Bosch-Eli-Black already suggested this.
I would like to add this example when checking function arguments, which is even shorter.
functionlog_animal(animal){animal??=throw"Animal can not be undefined or null";animal.name??=throw"Animal name can not be undefined or null";console.log(animal);}
I would like to add this example when checking function arguments, which is even shorter.
functionlog_animal(animal){animal??=throw"Animal can not be undefined or null";animal.name??=throw"Animal name can not be undefined or null";console.log(animal);}
There's no need to use compound assignment here, animal ?? throw ... would work just as well.
I can add these to the explainer once #17 has merged.
I have an additional example of where I think this feature would be useful: In conjunction with the nullish coalescing operator.
For example:
Would this be worth adding to the list of examples? :)
The text was updated successfully, but these errors were encountered: