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
fix(learn): add test to return early pattern #38751
Conversation
Currently no test for a = 0 or b = 0. This results in if(a<=0 || b<= 0) also being a valid solution
Hi @ERElli Thanks for the quick PR. We would need a third party confirmation on the issue thread (or anywhere else, like forum) before we can land this. Keeping this blocked for the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the test case, to avoid this code from passing, as well:
if (a < 0 || b <= 0) {
return undefined;
}
...lgorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.english.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @ERElli 🎉 Congratulations on your first contribution to freeCodeCamp 🎉
For future reference, it's good to give your branch a more descriptive name and start it with a scope. See #3
just below here in the docs
Thanks @moT01! I realized that I hadn't named my branch properly after I had made the PR and there were already comments. I wasn't sure if closing the PR and renaming the branch was the right thing to do. I'll make sure to name my branch properly next time! |
* add: test to return early pattern Currently no test for a = 0 or b = 0. This results in if(a<=0 || b<= 0) also being a valid solution * fix: typo in test text * fix: update return early pattern test Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
Currently no test for a = 0 or b = 0. This results in if(a<=0 || b<= 0) also being a valid solution
Checklist:
Update index.md
)master
branch of freeCodeCamp.Closes #38750