Letter Changes coderbyte I've solved the problem below just would like some feedback? 


  The function LetterChanges(str) takes a str parameter 
  
  Replace every letter in the string with the letter following it in the
  alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel
  in this new string (a, e, i, o, u) and finally return this modified
  string.


function LetterChanges(str) { 
  var newString = '';
  var newCode = 0;
  var len = str.length;
  var i = 0;

  for (; i &lt; len; i++){
  /*Using ASCII code: this if statement return true if character at
  str[i] is a - y*/
  if (str.charCodeAt(i) &gt;= 97 &amp;&amp; str.charCodeAt(i) &lt;= 121) {
      //Assign ASCII code plus 1 to a variable newCode
      newCode = str.charCodeAt(i) + 1;
      /*Check to see newCode variable is a lower case vowel from ASCII 
      and if so, add capital of that vowel to newString variable, else
      use newCode variable to add character to newString*/
      if (newCode == 101) {
          newString += String.fromCharCode(69);
      } else if (newCode == 105) {
          newString += String.fromCharCode(73);
      } else if (newCode == 111) {
          newString += String.fromCharCode(79);
      } else if (newCode == 117) {
          newString += String.fromCharCode(85);
      } else {
          newString += String.fromCharCode(newCode);
      }

  /*Using ASCII code: this if statement return true if character at
  str[i] is z, in that case adding capital A*/
  } else if (str.charCodeAt(i) == 122){
      newString += String.fromCharCode(65);

  /*else just add to newString i.e uppercase(question didn't specify), 
  symbols, number...*/        
  } else {
      newString += str[i];
  }
 }
return newString; 

}
DRY (Don't Repeat Yourself)

You have a list of else if statements that all do the same thing. JavaScript has the .toUpperCase method so hardcoding character codes to perform capitalization is unnecessary. You can do newString += str[i].toUpperCase().  

Use variables for constant values

Instead of constant values directly in your code, use a variable to store them. You know you want to capitalize vowels, so you can create an array var vowels = ['a', 'e', 'i', 'o', 'u'] to store your constants. This makes it easier to modify in the future - like if the requirements changed and now y is a vowel.

Putting these two together, your capitalization code can be pretty concise:

// vowels.indexOf(str[i]) !== -1 would work, too
if(vowels.includes(str[i]){ 
  newString += str[i].toUpperCase();
}