Skip to content
Open
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
8 changes: 8 additions & 0 deletions sgoldenbird/level0/문자열_바꿔서_찾기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function solution(myString, pat) {
let switchedString = "";
for (let char of myString) {
switchedString += char === "A" ? "B" : "A";
}

return switchedString.includes(pat) ? 1 : 0;
}
6 changes: 6 additions & 0 deletions sgoldenbird/level0/숫자_찾기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function solution(num, k) {
const stringNum = String(num);
const stringK = String(k);
Copy link
Contributor

Choose a reason for hiding this comment

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

k도 형변환 해주는 게 더 명시적이어서 좋은 것 같네용!


return stringNum.indexOf(stringK) + 1 || -1;
}
6 changes: 6 additions & 0 deletions sgoldenbird/level1/핸드폰_번호_가리기.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function solution(phone_number) {
const hidden = "*".repeat(phone_number.length - 4);
Copy link
Contributor

Choose a reason for hiding this comment

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

repeat() 사용하셨군용~👍

const last = phone_number.slice(-4);
Copy link
Contributor

Choose a reason for hiding this comment

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

이 방법을 생각못했는데 간단하게 해결하셨네용!


return hidden + last;
}