Skip to content

Commit 4c1514a

Browse files
authored
Merge pull request #64 from front-studium/Insung-Jo
`week10` 문제 완료했습니다.
2 parents 802e210 + 96e8716 commit 4c1514a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function solution(str1, str2) {
2+
if(typeof str1 !== 'string' || typeof str2 !== 'string') throw new Error('문자를 입력해주세요.');
3+
const result = str1.indexOf(str2) !== -1 ? 1 : 2;
4+
5+
return result;
6+
}

Insung-Jo/level_0/짝수의 합.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function solution(n) {
2+
if(typeof n !== 'number') throw new Error('정수를 입력해주세요.');
3+
if(n <= 1) return 0;
4+
5+
let result = 0;
6+
7+
for(let i = 2; i <= n; i+=2){
8+
result += i;
9+
}
10+
11+
return result;
12+
}

0 commit comments

Comments
 (0)