Tell us what’s happening:
Describe your issue in detail here.
I am trying to get this challenge done and it seems that the returned values are correct. The issue is that the larger numbers are never being executed because it reaches the maximum call size. Am I just being that inefficiant? Or is it some other issue?
**Your code so far**
function smallestCommons(arr) {
// this orders the arr
let numArray = arr
numArray = numArray.sort(function (a, b) { return a - b; });
// this lists the values to check
let checkList = []
for (let i = numArray[0]; i < numArray[1]; i++){
checkList.push(i)
}
// this is the checkFunction
function algo(value1, value2, counter, list){
if (list.filter(a => (value2 * counter) % a != 0).length == 0){
return(value2*counter)
}
else{
return algo(value1, value2, counter+1, list)
}
}
return algo(arr[0],arr[1], 1, checkList)
}
smallestCommons([1,13]);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36
Challenge: Smallest Common Multiple
Link to the challenge: