i am currently undertaking algorithm challenge after completing Js Course on freecode. i ran in to a ploblem when trying to solve the title case challenge. the function i implemented works for all sentences and even gives accurate result for failed case. hw can i circumvent this to move to my next challenge. this is my code
tnk u. i did not take note of the apostroph. i already solved the problem using a different approach. see my implementation below
function titleCase(str)
{
str = str.toLowerCase();
var strArr = str.split(" ");
var newstrArr = strArr.map(function (val) {
return val.replace(val.charAt(0),val.charAt(0).toUpperCase());