-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suggestion: Null-Coalescing Operator #128
Comments
Spider got its tenary operator style from Swift. I also thought of doing the last style. It's much more compact and still easy to distinguish. |
This was discussed already in #97, some other topics and AFAIR on IRC. Personally, I see no reason to change Just a note from me about |
I see the point of not changing function add(a, b) {
b ?= a; // b = b ?? a
} and you can still use function go(opts) {
var cake = opts.cake ?? 'lie';
} |
Good points, all. I only wanted to give some food for thought. I see this topic has been discussed before. Thanks for reading my issue. |
This syntax seems to be a more compact ternary operator, is that right?
If so, may I suggest a slightly different form? Per a suggestion here, I re-write the above which checks a variable and defaults it if the variable is empty/false:
The text was updated successfully, but these errors were encountered: