test 2022-02-22
confirm
@91263eaf691a88a927df52284ec9b59e34f7477a
al01/13.js
--- al01/13.js
+++ al01/13.js
@@ -7,11 +7,12 @@
         let asciiNum = s.charCodeAt();   //char->ASCII
 
         if(asciiNum >= 65 && asciiNum <= 90) answer += String.fromCharCode(asciiNum + 32);   //upper->lower
-        else /*****************************/ answer += String.fromCharCode(asciiNum - 32);   //lower->upper
+        else if(asciiNum >= 97 && asciiNum <= 122) answer += String.fromCharCode(asciiNum - 32);   //lower->upper
+        else answer += "";
     }
 
     return answer;
 
 }
 
-console.log(solution("StuDY"));
(No newline at end of file)
+console.log(solution("Stu2DY"));
(No newline at end of file)
al01/15.js
--- al01/15.js
+++ al01/15.js
@@ -1,11 +1,7 @@
 function solution(str){
 
-    if(str.length % 2 == 0){
-        return str.substr((str.length / 2) - 1, 2);
-    }else {
-        return str.substr((str.length / 2), 1);
-    }
-
+    if(str.length % 2 == 0) return str.substr((str.length / 2) - 1, 2);
+    else /****************/ return str.substr((str.length / 2), 1);
 }
 
 console.log(solution("study"));
Add a comment
List