Inserting items into a 2D array
<p>I am working on solving an algorithm (do not want to explain my approach, as I am still trying to solve it on my own). However I am having difficulty with a particular part.</p>

<pre><code>function smallestCommons(arr)
{
  var rangeArray = [];
  var outterArray = [];
  var testArray = [];

  arr = arr.sort(function(a,b){return a&gt;b});

  for(var i=arr[0];i&lt;=arr[1];i++)
  {
    rangeArray.push(i);
  }
  for(var j=0;j&lt;rangeArray.length;j++)
  {
    for(var k=1;k&lt;=100;k++)
    {
      if(k%rangeArray[j] === 0)
      {
        outterArray.push([k]);
      }
    }
  } 
  console.log(outterArray);
}

smallestCommons([1,5]);
</code></pre>

<p>The second part of the code I am looping through the items in rangeArray [1,2,3,4,5] and trying to insert all the multiples (from 1 to 100) of EACH index into a DIFFERENT array. But my code currently is pushing EACH individual number which is a multiple into its own array per each digit. I need it to push all the multiples of each index of rangeArray into outer array. So that I end up with a 2D array of all the multiples of rangeArray in different array for every iteration of j. </p>

<p>So for example instead of ending up with </p>

<pre><code>outerArray == [[1],[2],[3]...]
</code></pre>

<p>I would end up with all the multiples of 1 (up to 100) into one array and then all the multiples of 2 into another array and so on and so forth so it looks like this. </p>

<pre><code>outerArray == [[1,2,3,4...] [2,4,6,8...] [3,6,9,12...]] 
</code></pre>

<p>Its very hard to explain, hopefully I have been clear. Thanks.</p>