Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
6 changes: 6 additions & 0 deletions Insung-Jo/level_0/문자열 안에 문자열.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function solution(str1, str2) {
if(typeof str1 !== 'string' || typeof str2 !== 'string') throw new Error('문자를 입력해주세요.');
const result = str1.indexOf(str2) !== -1 ? 1 : 2;

return result;
}
12 changes: 12 additions & 0 deletions Insung-Jo/level_0/짝수의 합.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function solution(n) {
if(typeof n !== 'number') throw new Error('정수를 입력해주세요.');
if(n <= 1) return 0;

let result = 0;

for(let i = 2; i <= n; i+=2){
result += i;
}

return result;
}