**Tell us what’s happening:**

Hey all! I am working on the smallest common multiple problem…my plan is to make a 2D array with all of the multiples of each element in the range, up to an arbitrary multiple, then find the least common element in all of these arrays.

However, when I am populating the 2D array with nested for loops, my browser freezes, presumably due to an infinite loop.

I know there are probably better solutions out there for the scm problem, but I am really stumped on why this code would cause an infinite loop.

The last commented out block is the offending piece of code.

Any ideas??

Thanks!!

–t

**Your code so far**

```
function smallestCommons(arr) {
var sc;
var min;
min = Math.min(arr[0],arr[1]);
var max;
max = Math.max(arr[0],arr[1]);
var range;
range=[];
var cm;
var m;
m=[];
var i;
var j;
var arr_len;
for(i=0;i<=(max-min);i++){
range[i]=min+i;
}
cm = range.reduce(function(a,b){
return a*b;
});
/* this block causes browser to freeze....
for(i=0;i<range.length;i++){
m[i]=[];
arr_len = cm/range[i];
for(j=0;j<arr_len;j++){
m[i][j]=range[i]*(j+1);
}
}
*/
return m;
//?? - find smallest common element of all arrays in m
//return sc;
}
smallestCommons([1,5]);
```

**Your browser information:**

Your Browser User Agent is: `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36`

.

**Link to the challenge:**