Skip to content

Commit 0c76b01

Browse files
authored
Merge pull request #128 from front-studium/Insung-Jo
`week28` 문제 완료
2 parents 8f3ca83 + dd62d47 commit 0c76b01

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function solution(my_string) {
2+
const REGEX = /[a-z]/;
3+
let word = my_string.split("");
4+
let answer = [];
5+
6+
for (let i = 0; i < my_string.length; i++) {
7+
if (word[i].match(REGEX)) {
8+
answer.push(word[i].toUpperCase());
9+
} else answer.push(word[i].toLowerCase());
10+
}
11+
12+
return answer.join("");
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function solution(my_string, num1, num2) {
2+
const answer = my_string.split("");
3+
const temp = answer[num1];
4+
answer[num1] = answer[num2];
5+
answer[num2] = temp;
6+
7+
return answer.join("");
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function solution(num) {
2+
const number = Math.abs(num);
3+
if (number % 2 === 1 || number < 0) return "Odd";
4+
if (number % 2 === 0 || number === 0) return "Even";
5+
}

0 commit comments

Comments
 (0)