Tell us what’s happening:
Hi guys,
On the Title Case a Sentence exercise, my code pass all the tests and even I made others more specifically regarding regexp such as symbols and numbers and still the exercise doesn’t let me keep going. Is anything wrong with my code or is a problem with the exercise itself?
Thank you so much.
Regards,
Javier
Your code so far
function titleCase(str) {
var word = str.replace(/[^A-Z^a-z^şŞıİçÇöÖüÜĞğ^' ]+/i, '');
word = word.split("");
var firstChar = word.shift().toUpperCase();
word = word.join("").toLowerCase();
word = firstChar + word;
return word;
}
titleCase("sHoRt AnD sToUt");
titleCase("7hello");
titleCase("&hello");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/title-case-a-sentence