test
2022-02-22
confirm
@91263eaf691a88a927df52284ec9b59e34f7477a
--- al01/13.js
+++ al01/13.js
... | ... | @@ -7,11 +7,12 @@ |
7 | 7 |
let asciiNum = s.charCodeAt(); //char->ASCII |
8 | 8 |
|
9 | 9 |
if(asciiNum >= 65 && asciiNum <= 90) answer += String.fromCharCode(asciiNum + 32); //upper->lower |
10 |
- else /*****************************/ answer += String.fromCharCode(asciiNum - 32); //lower->upper |
|
10 |
+ else if(asciiNum >= 97 && asciiNum <= 122) answer += String.fromCharCode(asciiNum - 32); //lower->upper |
|
11 |
+ else answer += ""; |
|
11 | 12 |
} |
12 | 13 |
|
13 | 14 |
return answer; |
14 | 15 |
|
15 | 16 |
} |
16 | 17 |
|
17 |
-console.log(solution("StuDY"));(No newline at end of file) |
|
18 |
+console.log(solution("Stu2DY"));(No newline at end of file) |
--- al01/15.js
+++ al01/15.js
... | ... | @@ -1,11 +1,7 @@ |
1 | 1 |
function solution(str){ |
2 | 2 |
|
3 |
- if(str.length % 2 == 0){ |
|
4 |
- return str.substr((str.length / 2) - 1, 2); |
|
5 |
- }else { |
|
6 |
- return str.substr((str.length / 2), 1); |
|
7 |
- } |
|
8 |
- |
|
3 |
+ if(str.length % 2 == 0) return str.substr((str.length / 2) - 1, 2); |
|
4 |
+ else /****************/ return str.substr((str.length / 2), 1); |
|
9 | 5 |
} |
10 | 6 |
|
11 | 7 |
console.log(solution("study")); |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?