Update factorialRecursive.js by checking the factorial of negative numbers at run time#1009
Closed
njiddasalifu wants to merge 0 commit into
Closed
Update factorialRecursive.js by checking the factorial of negative numbers at run time#1009njiddasalifu wants to merge 0 commit into
njiddasalifu wants to merge 0 commit into
Conversation
|
It's bad practice to return a string or a number and then inspect it. You should throw an error for invalid input instead. |
|
There's no such thing as "documen". Also, writing to the document is probably even worse than returning a string. You should throw an error instead. |
|
You're throwing a string instead of an error now. |
Author
|
take a look again.
…On Sun, Mar 19, 2023 at 2:39 PM Lazar Ljubenović ***@***.***> wrote:
You're throwing a string instead of an error now.
—
Reply to this email directly, view it on GitHub
<#1009 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWTKIXOPSB5HFOSOAKGFC6DW44ECFANCNFSM6AAAAAAV54UCZ4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
olgunkaya
suggested changes
Mar 31, 2023
olgunkaya
left a comment
There was a problem hiding this comment.
Do you really need that last number > 1 control ? You already guaranteed there the number is bigger than 1
Author
|
@olgunkaya ooh i see I will remove that. Actually the fisrt lines took care of that already. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
added a clear check for the factorial eveluation of negative numbers to avoid wrong answer at runtime.