Hello fellow campers! I posted this same question under the guide forum for this particular exercise, but I’m putting it here as well in hopes to get some guidance.
I’ve had such hard time solving this exercise. I finally did it after looking at this page (guide for the title a case exercise), but it feels I have copied the answer even with minor tweaks.
I’ve copied 2 of my codes before I reviewed this site (I tried a few). They DO NOT work, but not sure why. What am I NOT seeing? Please Help!!!
ATTEMPT #1
function titleCase(str) {
var splitStr = str.toLowerCase().split(" “);
var capitalizeFirstWord = (function(){
splitStr.replace(splitStr.chartAt(0), splitStr.chartAt(0).toUpperCase());
});
return capitalizeFirstWord.join(” ");
}
titleCase(“i’m a little tea pot”);
ATTEMPT #2
function titleCase(str) {
var splitStr = str.toLowerCase().split(" “);
var capitalizeFirstWord = function(val){
return val.replace(val.chartAt(0), val.chartAt(0).toUpperCase());
};
return capitalizeFirstWord.join(” ");
}
titleCase(“I’m a little tea pot”);
IN ADVANCE THANKS SO MUCH FOR YOUR GUIDANCE!!!