One of the methods is the map() method. Before applying this method, firstly, you should lowercase and split the string:
The third method that is used to make the string title case is the for loop:
The map() method generates a new array with the output of calling a provided function on every element in the specified array. The method calls a provided callback function only once for each element in an array, and generates a new array from the outputs. Callback is executed only for indexes of the array which have assigned values including undefined.
The replace() method executes a search for a match in a string, and replaces the matched substring with a replacement one. The pattern can be either a string or a regular expression. The replacement can be either a string or a function that is called for each match. If the pattern is a string, only the first occurrence will be replaced, and the initial string will be left unchanged.
The for loop is used for executing a block of code for a certain number of times. The for loop consists of three optional expressions that are placed in parentheses and separated by semicolons followed by a statement to be invoked in the loop.