In the second one , as toUpperCase() is a function, you can call a function with an arrow “=>”, so if the arrows isn’t there, the code can’t call the function.
(i’m not a pro just remember about arrow functions)
careful there, this is wrong syntax, maybe you wanted to write function(L) {return L.toUpperCase();}
the thing is that L is defined because it is a function parameter, remove the function and L is not defined and you can’t use it
also, the replace method accepts a string as second argument or a callback function, L.toUpperCase() is neither, it’s just an expression with a method used on a never used before variable
the replace method pass to the callback function each match, so yes in this case the L parameter refers to each character matched
with different regular expressions the matched strings could be words, instead of single characters, or any other part of the string on which replace is used
callback is the term used for functions that are arguments of other functions/methods, so when a method expect a function as argument we say that it takes a callback.
Other methods that take a callback are for example map and filter
you can give any name to function parameters
for the function L => L.toUpperCase() it was chosen to use L.
It works anyway if you change the name of the parameter, but for short callbacks written with arrow function it is usually used a single letter.
For example if we want to be descriptive in naming the parameters it could have been: firstLetterOfWord => firstLetterOfWord.toUpperCase()