[숫자 야구 게임] 김영현 미션 제출합니다.#4
Open
202212025 wants to merge 18 commits intogdgoc-skhu-missions:202212025from
Open
Conversation
|
안녕하세요 영현님 ~ 리뷰를 하게 된 오혜성 입니다! 다음부터는 PR 올리실 때 우측 상단 리뷰어에 저를 넣어주실 수 있으실까용??
고생하셨습니다 👍 퇴근 이후에 살펴볼게요! |
hyesungoh
requested changes
Apr 2, 2024
Comment on lines
+100
to
+103
| async play() { | ||
| Console.print('숫자 야구 게임을 시작합니다.'); | ||
| await playNumberGame(); | ||
| } |
There was a problem hiding this comment.
여기서 async await이 필요한 이유는 무엇일까요?
그리고 async await는 비동기 코드의 어떤 문제점을 해결하는 것일까요?
Comment on lines
+49
to
+50
|
|
||
| async function playNumberGame() { |
There was a problem hiding this comment.
어떤 함수는 파스칼 케이스이고, 어떤 함수는 카멜 케이스인데 그 이유가 무엇인가요?
Comment on lines
+3
to
+4
| function RandomAnswer() { | ||
| const CORRECT_ANSWER = []; |
There was a problem hiding this comment.
해당 함수의 동작을 함수의 이름만 보고 유추하기에 편한 이름이라 생각되시나용??
Comment on lines
+16
to
+17
| let userInput; | ||
| let userAnswer; |
There was a problem hiding this comment.
이 두 변수를 let으로 선언하신 이유가 무엇인가요?
let은 const, var과 무슨 차이를 갖고 있나요?
Comment on lines
+44
to
+45
| if (userAnswer[i] === CORRECT_ANSWER[i]) strike++; | ||
| else if (CORRECT_ANSWER.includes(userAnswer[i])) ball++; |
| let strike = 0; | ||
| let ball = 0; | ||
|
|
||
| for (let i = 0; i < 3; i++) { |
There was a problem hiding this comment.
3이라는 상수를 매직 넘버로 사용하지 않고, 이를 개선하려면 어떻게 해야될까요?
Comment on lines
+40
to
+41
| let strike = 0; | ||
| let ball = 0; |
Comment on lines
+60
to
+71
| let resultMessage = ''; | ||
|
|
||
| if (ball > 0) { | ||
| resultMessage += `${ball}볼 `; | ||
| } | ||
| if (strike > 0) { | ||
| resultMessage += `${strike}스트라이크`; | ||
| } | ||
| if (strike === 0 && ball === 0) { | ||
| resultMessage = '낫싱'; | ||
| } | ||
| Console.print(resultMessage); |
Comment on lines
+72
to
+75
| if (strike === 3) { | ||
| Console.print('3개의 숫자를 모두 맞히셨습니다! 게임 종료'); | ||
| break; | ||
| } |
There was a problem hiding this comment.
ealry return 패턴을 적용하면 어떤 장점과 단점이 생길까요?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
숫자 야구 게임 미션 제출 _ 김영현
어려웠던 점
js가 아직 익숙치 않고, 새로 접한 것들이 많아서 코드를 작성하고 설명하는 데에 많은 어려움이 있었습니다.
궁금한 점
else를 사용하지 않고 작성하려면 어떻게 해야 하는지 궁금합니다.
함수 분리를 얼마나 잘게(?)하는 것이 좋은 지 궁금합니다.
느낀 점
실력 부족을 매우 잘 느꼈습니다....