Implement the function toLowerCase (), which receives a string parameter, str, and converts the uppercase letters in the string to lowercase letters, and then returns a new string.
Example 1:
Input: "Hello"
Output: "Hello"
Example 2:
Input: "Here"
Output: "Here"
Example 3:
Input: "Lovely"
Output: "Lovely"
1varLower =' ABCDEFGHIJKLMNOPQRSTUVWXYZ '
2varUpper =' ABCDEFGHIJKLMNOPQRSTUVWXYZ '
3
4varFind = function (s, Target){
5varL = s.length
6if(S.includes (target)) {
7 for(varI=0; i<l; i++) {
8if(S[i] = = target)returnI
9}
Ten}
Onereturn -1
A}
-
-vartoLowerCase = function (str){
thevarR ="'
-
- for(vari =0; i < str.length; i++) {
-//uppercase is converted to lowercase
+if(Upper.includes (Str[i])) {
-varIDX = Find (upper, str[i])
+R + = Lower[idx]
A}Else{
at//is the lower case directly splicing up
-R + = Str[i]
-}
-}
-returnR
-}
709. Convert to lowercase letters