Skip to content

Commit 617ec6b

Browse files
fix number checking
1 parent d79e2f7 commit 617ec6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Maths/CoPrimeCheck.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ const GetEuclidGCD = require('./GetEuclidGCD')
2020
* @returns return correspond boolean value, if both number are co-prime return `true`, else return `false`.
2121
*/
2222
const CoPrimeCheck = (firstNumber, secondNumber) => {
23+
// firstly, check that input is a number or not.
24+
if (typeof firstNumber !== 'number' || typeof secondNumber !== 'number') {
25+
return new TypeError('Argument is not a number.');
26+
}
2327
/*
2428
This is the most efficient algorithm for checking co-primes
2529
if the GCD of both the numbers is 1 that means they are co-primes.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy