I'm developing a program that takes a string, splits it, returns the first string with only the first letter capitalized and returns the second string with all the letters capitalized. The code is below:
var name = "ThEoDORe RoOseVElT"; function nameChanger(oldName) { var finalName = oldName; var splitNames = finalName.split(" "); var secondName = splitNames.pop(); var firstName = splitNames; var secondName2 = secondName.toUpperCase(); var firstName2 = firstName.toLowerCase(); var finalName = firstName + " " + secondName; return finalName; }; The error given states 'Uncaught' and 'TypeError: undefined is not a function'. I know my problem is line 11 and 12 with the toUpperCase() and toLowerCase() methods but I don't know why.