title: JavaScript replace all the vowels in a string toUpperCase?
body: <p>Again new to JavaScript and coming over from Ruby/Python so I feel like <code>JS</code> is a smack in the face but yet I'm committed to mastering it. I want to replace all of the <code>vowels</code> to <code>vowels.toUpperCase()</code>. </p>
  
  <p><strong>Example 1</strong> 
  I tried with <code>map</code> but I couldn't understand how to pass the index of the current iteration:</p>
  
  <pre><code>function vowelToUpCase(idx){
      if(vowel.test(new_arr[idx])) {
          new_arr[idx] = new_arr[idx].toUpperCase();
      }
  }
  
  new_arr.map(vowelToUpCase(idx));
  new_arr.join('');
  </code></pre>
  
  <p><br></p>
  
  <p><strong>Example 2</strong> 
  Anyway I figured this can be easily done on a <code>str</code> with some simple <code>regex</code>, well I figured wrong because I'm stuck with what you see below.</p>
  
  <pre><code>var new_arr = [ 'e', 'i', 'f', 'm', 'e', 'm', 'p', '*', '3' ];
  var vowel = /[aeiou]/gi;
  var str = new_arr.join('');
  console.log(str);
  
  str.replace(/([aeiou])/gi, function (match) { 
      var str = match.toUpperCase();
      console.log(str);
  });
  console.log(str);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>eifmemp*3
  E
  I
  E
  eifmemp*3
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>EIfmEmp*3
  </code></pre>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Can you pass an index to the <code>map()</code> function?</li>
  <li>What's wrong with my <code>str.replace</code> example?</li>
  </ol>