Struggle! "Title Case a Sentence"

I’ve found all the curriculum fairly simple up to this point. However as soon as I started the Basic Algorithm Scripting section, it felt like I had learned nothing.

I finally studied solution 3 on “Title Case a Sentence” long enough to understand it so I will move on, but the part in .replace(), where it suddenly uses the L character confused me.
Can someone please explain this to me? Is it a shorthand to recall something? Lowercase? I just don’t understand that one part.

I sometimes feel like I’m wasting my time on this, since I’m not able to come up with these solutions on my own.

Can you please share your code so far and a link to the challenge?

without the code you are referring to is still not possible to give an answer

I wouldn’t look at solution 3 if you are not comfortable with regular expressions.

The basic algorithm section is tricky, and I would recommend using read-search-ask instead of looking at the solutions. We’re here on the forum to help you work your way towards the answer and learn as you go!

I appreciate that, thank you. I did plenty of reading and searching. I understand the RegEx except for one thing and this one thing is my “ask”: in the solution 3, what does “L” in “L => L.toUpperCase()” mean?
Thanks again.

That little bit there is saying to replace all matching letters L with the result from the arrow function. In this case, the arrow function replaces the matching letter with an upper case string value for the letter.

Thank you! So the L is a shorthand for “letters recognized by the regex?” I remember learning this once, but cannot find where. Google searching isn’t helping either.

L is the variable used in this particular arrow function. We could have used any variable, but the author of this example chose L.

Thank you. I’ll do some further studying to remember this. I appreciate your time. Cheers

1 Like