Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 517879a

Browse files
committed
add to lower case question
1 parent 23de520 commit 517879a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

701-800/709-to-lower-case.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
const isUpperCase = char => {
3+
let ascii = char.charCodeAt(0);
4+
5+
if (ascii >= 65 && ascii <= 90) {
6+
return true;
7+
}
8+
9+
return false
10+
}
11+
12+
const toLower = char => {
13+
let ascii = char.charCodeAt(0);
14+
15+
ascii = String.fromCharCode(ascii + 32);
16+
17+
return ascii
18+
}
19+
20+
var toLowerCase = function (str) {
21+
return str.split("").map(s => isUpperCase(s) ? toLower(s) : s).join("");
22+
};

0 commit comments

Comments
 (0)