Tell us what’s happening:
I have checked the code in a browser and it looks good, but not able to pass through the test, can you please help if there is something wrong in the code.
Your code so far
function titleCase(str) {
var tokens = str.split(' ');
var outputTokens = tokens.map(function (eachToken) {
return eachToken.slice(0, 1).toUpperCase() + eachToken.slice(1).toLowerCase();
});
var output = outputTokens.join(' ');
console.log("Output : " + output);
return str;
}
titleCase("I'm a little tea pot");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
.
Link to the challenge: