diff --git a/Maths/CoPrimeCheck.js b/Maths/CoPrimeCheck.js index 1bc3d32ce..f85cf8906 100644 --- a/Maths/CoPrimeCheck.js +++ b/Maths/CoPrimeCheck.js @@ -20,6 +20,10 @@ const GetEuclidGCD = require('./GetEuclidGCD') * @returns return correspond boolean value, if both number are co-prime return `true`, else return `false`. */ const CoPrimeCheck = (firstNumber, secondNumber) => { + // firstly, check that input is a number or not. + if (typeof firstNumber !== 'number' || typeof secondNumber !== 'number') { + return new TypeError('Argument is not a number.'); + } /* This is the most efficient algorithm for checking co-primes if the GCD of both the numbers is 1 that means they are co-primes.