Tell us what’s happening:
Why does my code not pass the last two cases? It worked on my own laptop.
Your code so far
function smallestCommons(arr) {
let mutl = Math.max(...arr);
let rag = [];
for(let i=Math.min(...arr); i<=Math.max(...arr); i++) {
rag.push(i);
}
while(1) {
if(rag.map((e)=>(mutl%e === 0)).every((a)=>(a === true))) {
break;
}
mutl +=1;
}
return mutl;
}
smallestCommons([1,5]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.