We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d79e2f7 commit 617ec6bCopy full SHA for 617ec6b
Maths/CoPrimeCheck.js
@@ -20,6 +20,10 @@ const GetEuclidGCD = require('./GetEuclidGCD')
20
* @returns return correspond boolean value, if both number are co-prime return `true`, else return `false`.
21
*/
22
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
+ }
27
/*
28
This is the most efficient algorithm for checking co-primes
29
if the GCD of both the numbers is 1 that means they are co-primes.
0 commit comments