title: Repeat elements in array based on length of another array
body: <p>I have two arrays of string with dynamic lenght, for example:</p>
  <pre class="lang-js prettyprint-override"><code>const categories = ['apple', 'pear', 'melon', 'lemon']
  const colors = ['red', 'blue', 'green']
  </code></pre>
  <p>and I would like that <code>colors.lenght &gt;= categories.lenght</code>. Missing element of <code>colors</code> should be repeated. Example:</p>
  <pre class="lang-js prettyprint-override"><code>const categories = ['apple', 'pear', 'melon', 'lemon']
  const colors = ['red', 'blue', 'green', 'red'] // colors[3] = colors[0]
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>const categories = ['apple', 'pear', 'melon', 'lemon', 'strawberry', 'orange']
  const colors = ['red', 'blue', 'green', 'red', 'blue', 'green']
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>const categories = ['apple', 'pear', 'melon', 'lemon', 'strawberry', 'orange', 'cherry']
  const colors = ['red', 'blue', 'green', 'red', 'blue', 'green', 'red']
  </code></pre>
  <p>How can I do that?</p>
  <p>I start creating this function but I don't know how to repeat colors in the right way:</p>
  <pre class="lang-js prettyprint-override"><code>function adjustLenghts(categories: string[], colors: string[]) {
    const overflowingCategoriesItems = domain.slice(colors.length, categories.length)
    const repeatedRange = ??
    const newColors = ??
  
    return newColors
  }
  </code></pre>