DONT have idea to solve this so looked for hints but they are showing prototype something
Im new to this language and there was no prototype lesson in cirriculum so dont even have idea to solve this.
Looking for help if u can give me idea to solve this
Your code so far
function titleCase(str) {
return str;
}
titleCase("I'm a little tea pot");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.
You don’t need to know anything about prototypes at this point. The challenge wants you to use string methods such as toUpperCase and toLowerCase. These methods live on the String prototype, but you don’t have to know that in order to use the methods.
But these toUpperCase() and toLowerCase() are working to convert whole string in upper or lower case Can i have hint so that i could use that specific way to convert just first letter cuz hints in lessons are talking about things for which i have no idea
and one thing more that how does this replace() work
I happened to write a little article about prototypes in my new blog. Maybe it will shed a little light–basically it’s just the MDN docs with a bit more humor.
Exactly. At that point in the curriculum, you should already be familiar with a couple of methods you can use in this case. In plain English - it’s possible to turn the string into an array that contains all individual letters (take a look at the split method). Once you have all the individual letters as items in an array, you can individually convert them to upper or lower case, depending on their positions in the array.
To make it a little easier for you - imagine you first take the whole string and convert it to lower case. Then you’d only have to go through the words (-> split!) and convert only the first letter to upper case (->split again!).
replace is another String method which lets you replace the first occurence of a substring to something else.
Example:
let name = Qasim;
let newName = name.replace('Q', 'q');
console.log(newName); // qasim
in the documentation you can see methods named as String.prototype.toLowerCase()
the first part tells you it is a string method, ignore the middle, and the last part tells the name of the method, and you can read about what it does in the documentation