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

Add should keyword #5

Merged
merged 2 commits into from Jun 25, 2022
Merged

Add should keyword #5

merged 2 commits into from Jun 25, 2022

Conversation

Bellisario
Copy link
Contributor

Adds should keyword.

About (same added to README.md)

should

should can be used as an expression.
This keyword is useful if you want to prevent a function call (also async) to throw an error because you don't need to have any result and the real execution is just optional (so runs if supported).

should hello()

Is the same as:

try {
    hello();
} catch (e) {};

Warning: this feature can be helpful but also dangerous especially if you're debugging your application. In fact, this is made to be used as an optional function call (ex. should load content, but not necessary and knowing this feature is optional), if you call a function in this way while debugging, no error will be printed and the application will contine run as nothing happened.

@coderaiser
Copy link
Owner

Nice :)!

@coderaiser coderaiser merged commit beb1a4c into coderaiser:master Jun 25, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants