I'm having trouble identifying the bug in this code as it's not generating any output:
function convertToTitleCase (inputString) {
var wordArray = inputString.split(' ');
var outputArray = [];
for (var j = 0; j < wordArray.length; j++) {
outputArray.push(wordArray[j].charAt(0).toUpperCase() + wordArray[j].slice(1));
};
return outputArray.join(' ');
}
alert(convertToTitleCase("the quick brown fox"));