Tell us what’s happening:
I use to make my code in repl.it and there the result is correct however I can’t pass the code in FreeCodeCamp.
Your code so far
function smallestCommons(arr) {
arr.sort((a, b) => a - b);
let myArray = [];
for (let i=arr[0]; i <= arr[1]; i++) {
myArray.push(i);
}
for (let x=1; x < 10000000; x++) {
let checker = myArray.every(elem => x % elem == 0);
if (checker) {
return x;
}
}
}
smallestCommons([23,18]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
.
Link to the challenge: