Freecodecamp: Title Case A Sentence

Created on 4 May 2017  路  2Comments  路  Source: freeCodeCamp/freeCodeCamp

Title Case a Sentence

https://www.freecodecamp.com/challenges/title-case-a-sentence#?

Issue Description

I got an exact answer but still it showing red mark.

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36

function titleCase(str) {

var array=[],a=[];
array=str.split(" ");
for(i=0;i var small=array[i].toLowerCase().split("");
small[0]=small[0].toUpperCase();
a += small.join("");
a +=" ";
}
var b=a;
return b;
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");

screenshot

Most helpful comment

@PaulNewman-M In times like these, it is often helpful to use a site like JSBin to help debug your code. I did that, and looks like your code returns an extra space at the end of the converted string, which is why it doesn't pass - https://jsbin.com/yayabimapi/edit?js,console

Also, please visit the help room first for help with challenges, in future.

All 2 comments

@PaulNewman-M In times like these, it is often helpful to use a site like JSBin to help debug your code. I did that, and looks like your code returns an extra space at the end of the converted string, which is why it doesn't pass - https://jsbin.com/yayabimapi/edit?js,console

Also, please visit the help room first for help with challenges, in future.

Hi @PaulNewman-M

Thanks for reporting this issue.

Here are some next steps that you should follow before we can help you with your query:

IMPORTANT:
Please NOTE that this tracker is for reporting bugs and enhancements to freeCodeCamp's code base only.

Happy Coding!

P.S: Thanks @Manish-Giri

Was this page helpful?
0 / 5 - 0 ratings