Skip to content

Update factorialRecursive.js by checking the factorial of negative numbers at run time #1009

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

Closed
wants to merge 0 commits into from

Conversation

njiddasalifu
Copy link

added a clear check for the factorial eveluation of negative numbers to avoid wrong answer at runtime.

@lazarljubenovic
Copy link

It's bad practice to return a string or a number and then inspect it. You should throw an error for invalid input instead.

@lazarljubenovic
Copy link

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.

@lazarljubenovic
Copy link

You're throwing a string instead of an error now.

@njiddasalifu
Copy link
Author

njiddasalifu commented Mar 19, 2023 via email

Copy link

@olgunkaya olgunkaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need that last number > 1 control ? You already guaranteed there the number is bigger than 1

@njiddasalifu
Copy link
Author

@olgunkaya ooh i see I will remove that. Actually the fisrt lines took care of that already.

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.

3 participants