Closed njiddasalifu closed 1 year ago
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.
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 https://github.com/trekhleb/javascript-algorithms/pull/1009#issuecomment-1475260118, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWTKIXOPSB5HFOSOAKGFC6DW44ECFANCNFSM6AAAAAAV54UCZ4 . You are receiving this because you authored the thread.Message ID: @.***>
@olgunkaya ooh i see I will remove that. Actually the fisrt lines took care of that already.
added a clear check for the factorial eveluation of negative numbers to avoid wrong answer at runtime.