I need to make a function that reads a string input and converts the odd indexed characters in the string to upperCase and the even ones to lowerCase.
function
Strings in JavaScript are immutable, Try this instead:
function alternativeCase(string){ var newString = []; for(var i = 0; i < string.length; i++){ if (i % 2 != 0) { newString[i] = string[i].toUpperCase(); } else { newString[i] = string[i].toLowerCase(); } } return newString.join(''); }