# Smallest Common Multiple strange problem

Smallest Common Multiple strange problem
0

Tell us what’s happening:

Hello guys. Yesterday, I tried to complete this challenge, but I got to the point, where I couldn’t find an answer. Today I am trying the same, but with same result. The problem is, that my solution works for first four demands on the left (" `smallestCommons([1, 5])` should return a number." and so on…), but not the last two. I can’t figure out, why does my solution behave this way. I think it does not do what it’s supposed to, based on program I written. Here is my solution and I kindly ask you to take a look, if you guys can find the problem:

``````function smallestCommons(arr) {
arr = arr.sort ((a,b) => a-b);
var multiple = arr[1];

do{
for(let i=arr[1]; i>= arr[0]; i--){
if(multiple%i != 0){
multiple++;
break;
}

if(i===arr[0])
return multiple;
}
}while(1);
return arr;
}

smallestCommons([1,5]);
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0`.