Tell us what’s happening:
When I run this in my browser’s JS console, it checks out. However, the FreeCodeCamp tests don’t seem to work. I think I’m losing my mind.
Your code so far
function checkNum(target,factors) {
var everythingChecksOut = true;
for (var i = 0; i < factors.length; i++) {
everythingChecksOut = everythingChecksOut && target % factors[i] == 0;
}
return everythingChecksOut;
}
function getArrayRange(arr) {
var min = Math.min(...arr);
var max = Math.max(...arr);
var newarr = [];
for (var i = min; i <= max; i++) {
newarr.push(i);
}
return newarr;
}
function smallestCommons(arr) {
arr = getArrayRange(arr);
var i = 0;
var matchFound = false;
while (!matchFound) {
i++;
matchFound = matchFound || checkNum(i,arr);
}
return i;
}
smallestCommons([23,18]);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge: