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
5 changes: 5 additions & 0 deletions sgoldenbird/level_0/문자열안에_문자열.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function solution(str1, str2) {

return str1.includes(str2) ? 1 : 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

includes()와 삼항 연산자를 이용해서 쉽게 풀이가 가능하군용!👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 그냥 삼항 연산자 자체를 리턴하면 되는군요...!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

includes()를 잘 사용하지 않아서 어떤 건지 잘 기억이 안 났었는데 이번에 다시 복습할 수 있었습니다! 👍


}
11 changes: 11 additions & 0 deletions sgoldenbird/level_0/짝수의_합.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function solution(n) {
var answer = 0;

for(let i = 0; i <= n; i++){
if(i%2 === 0){
answer += i;
}
}

return answer;
}