title: Turn every second character to uppercase using map
body: <p>I have a string and need to turn it to uppercase using map function. It would be something like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var str = 'hello world how ya doing?';
  function toUpperCase(str){
    return str.split('').map((v,i) =&gt;  i%2 == 0 ? v[i].toLowerCase(): v[i].toUpperCase()).join('');
   }
  
  console.log(toUpperCase(str));</code></pre>
  </div>
  </div>
  </p>
  
  <p>But when I run it I get entire sentence in uppercase.</p>