# Is My Lowest Common Multiple Solution..too messy?

So I did struggle with this for a little while, i thought it was going to be more straightforward but I ran into a snag with the for loop I used to iterate numbers `for (x=1;x<10000000;x++)` to check against the range array.

I was thinking that setting a hard limit of 10,000,000 seemed arbitrary except to meet the requirements of the puzzle, but then i got to thinking, shouldn’t there be a limit? How much processing time would it take to check up to a trillion numbers?

As always your feedback is appreciated greatly.

``````//noprotect

function smallestCommons(arr) {
range = [];

arr.sort(ascending);
var min = arr, max = arr;

for(i=min;i<=max;i++){
range.push(i);
}//sequenced range in ascending order
for (x=1;x<10000000;x++){
for(i=0;i<max;i++){
if(x % range[i] !== 0){
break;
}
if (range[i] == max){
return x;
}//check if x will pass through to last element in sequence(max)
}
}

function ascending(a,b){
return a-b;
}
return range;
}

smallestCommons([23,18]);``````