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

feat(factorial): create exercise #441

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix/ refactor
  • Loading branch information
nik-rev committed Mar 22, 2024
commit 6c72df864b2db11c2ce49cf91742b6376fc03775
4 changes: 2 additions & 2 deletions 13_factorial/solution/factorial-solution.js
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ const factorial = function(n) {
if (/[-.]/.test(n + '')) return;

// +n converts n to a number
if (+n === 0 || +n === 1) return 1;
if (+n === 0) return 1;
return n * factorial(n - 1);
};

// Do not edit below this line
module.exports = factorial;
module.exports = factorial;