Content-Length: 272268 | pFad | http://github.com/TheAlgorithms/JavaScript/commit/dce525176cf29ae39ac3bdc6112fabcc829cdf46

4E fix: check with builtin function · TheAlgorithms/JavaScript@dce5251 · GitHub
Skip to content

Commit dce5251

Browse files
committed
fix: check with builtin function
1 parent b7ef53c commit dce5251

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Recursive/Factorial.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const factorial = (n) => {
1313
throw new TypeError('Not a Number')
1414
}
1515

16-
if ((n % 1) !== 0) {
16+
if (!Number.isInteger(n)) {
1717
throw new RangeError('Not a Whole Number')
1818
}
1919

2020
if (n < 0) {
21-
return new RangeError('Not a Positive Number')
21+
throw new RangeError('Not a Positive Number')
2222
}
2323

2424
if (n === 0) {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/TheAlgorithms/JavaScript/commit/dce525176cf29ae39ac3bdc6112fabcc829cdf46

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy