title: Keep dividing array until every item is 1
body: <p>I want to keep dividing a given array cm(arr) with this myArr [2,3,5,7] and store these values on another array (finalArr), I want to keep iterating until newArr items are 1</p>
  <pre><code>function cm(arr){
  
    let divide = [2,3,5,7];
    let finalArr = [];
  
   let newArr = arr.map(function(e){
      for(let i = 0; i &lt; divide.length; i++){
        if(parseInt(e/divide[i]) === e/divide[i]){
          finalArr.push(divide[i])
          return e/divide[i]; 
        }   
      } 
    });
  
   let newFinal = new Set(finalArr)
    console.log([...newFinal])
    console.log(newArr)
    
  }
  </code></pre>
  <pre><code>cm([2,3,4,5,6])
  
  [ 2, 3, 5 ] // the number that we divided each arr[item] with
  [ 1, 1, 2, 1, 3 ] // the output of arr[item]/divide[item]
  
  
  //desired output 
  
  [2,3,5,2,3] // keep dividing arr[item] with divide[item] until the second array had all items = 1
  [1,1,1,1,1]
  </code></pre>