Tell us what’s happening:
Can’t pass on 2 test. Aparently when the SCM is too big, the system stops processing the code before it reach the SCM. Probably an infinite loop protection.
Your code so far
function smallestCommons(arr) {
let found = false;
let mmc = 0;
arr = [].concat(arr).sort((a,b) => a - b)
do{
mmc++;
for(let i = arr[0];i <= arr[1]; i++){
if(mmc % i !== 0) break;
if(i == arr[1]) found = true
}
}while (!found)
return mmc;
}
console.log(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/74.0.3729.157 Safari/537.36
.