[J-Script ] Question

Write a function to take a positive integer and a prime number as an input and return true if the prime factors of the given positive integer are less than the given prime number

Example :

hasLessPrimeFactor(20,5) should return true because Prime Factors of a Number: 20 = 2 X 2 X 5

function hasLessPrimeFactor(number,primenum) {
return false;
}

hasLessPrimeFactor(20,5);

I’d break it down into smaller functions like so:
//Returns an array of factors of the given number
getFactors(num);

//Returns an array of all prime factors of the given number
getPrimeFactors(num); //Hint: use getFactors, then trim it down

//Returns true if the prime factors of the given number are less than the given prime number
hasLessPrimeFactor(num, primeNum)
{
var totalOfPrimeNums = getPrimeFactors(num).map(function(val){
return val;
}
return totalOfPrimeNums < primeNum;
}