Skip to content
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

Use ? assignment instead of or assignment #12

Open
adius opened this issue Jun 24, 2015 · 0 comments
Open

Use ? assignment instead of or assignment #12

adius opened this issue Jun 24, 2015 · 0 comments

Comments

@adius
Copy link
Contributor

adius commented Jun 24, 2015

name = nameEntry ? 'Peter'

instead of

name = nameEntry or 'Peter'

(Attention: The meaning is slightly different. ? tests for null and undefined but or tests for all falsy values. This, however, is what you want most of the time anyway.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant