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
Try this:
function alternativeCase(string){ var output = ""; for(var i = 0; i < string.length; i++){ if (i % 2 != 0) { output += string[i].toUpperCase(); } else { output += string[i].toLowerCase(); } } return output; }