title: Change a color of odd array elements in Javascript
body: <p>Lets say I have a string of 5 letters in COLOR and want C L and R to be of color blue or whatever color just different from even letters O and O. I tried to convert it to an array and then use for loop. But dont know how to assign color value to array element. This is code I have so far. </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;&lt;!-- Hide JavaScript
  
  var mystring='color';
  
  var myArray = mystring.split('');
  
  for(i=0; i &lt; myArray.length; i++){
  
  //checking for odd positions
  if(i % 2 == 0){
  mojArray[i]//how to add color code to each element?
  }
  else{
  mojArray[i];
  }
  document.write(myArray[i]);
  }
  --&gt;
  &lt;/script&gt;
  </code></pre>