Skip to content

[숫자 야구 게임] 김영현 미션 제출합니다.#4

Open
202212025 wants to merge 18 commits intogdgoc-skhu-missions:202212025from
202212025:main
Open

[숫자 야구 게임] 김영현 미션 제출합니다.#4
202212025 wants to merge 18 commits intogdgoc-skhu-missions:202212025from
202212025:main

Conversation

@202212025
Copy link
Copy Markdown

숫자 야구 게임 미션 제출 _ 김영현

어려웠던 점

js가 아직 익숙치 않고, 새로 접한 것들이 많아서 코드를 작성하고 설명하는 데에 많은 어려움이 있었습니다.

궁금한 점

else를 사용하지 않고 작성하려면 어떻게 해야 하는지 궁금합니다.
함수 분리를 얼마나 잘게(?)하는 것이 좋은 지 궁금합니다.

느낀 점

실력 부족을 매우 잘 느꼈습니다....

@hyesungoh hyesungoh self-requested a review April 2, 2024 01:27
@hyesungoh
Copy link
Copy Markdown

안녕하세요 영현님 ~ 리뷰를 하게 된 오혜성 입니다!

다음부터는 PR 올리실 때 우측 상단 리뷰어에 저를 넣어주실 수 있으실까용??

그래야 저에게 알림이 직접적으로 오거든요!

추후 리뷰 이후 제가 다시 확인해 주셨으면 하다면, 재요청 버튼도 클릭 부탁드려요!

고생하셨습니다 👍 퇴근 이후에 살펴볼게요!

Copy link
Copy Markdown

@hyesungoh hyesungoh left a comment

Choose a reason for hiding this comment

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

고생하셨어요!! 👍 👍

조금 딱딱하게 느껴지실 수도 있겠지만, 영현님의 성장을 도모하는 마음으로 코멘트 남겨보았습니다 ~

코멘트는 의견 정도로 생각해 주시고 토론 혹은 논의가 필요하다고 생각하신다면 거침없이 답글 남겨주세요!

재확인이 필요하실 때 리뷰 재요청 주세요~

Comment thread src/App.js
Comment on lines +100 to +103
async play() {
Console.print('숫자 야구 게임을 시작합니다.');
await playNumberGame();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

여기서 async await이 필요한 이유는 무엇일까요?

그리고 async await는 비동기 코드의 어떤 문제점을 해결하는 것일까요?

Comment thread src/App.js
Comment on lines +49 to +50

async function playNumberGame() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

어떤 함수는 파스칼 케이스이고, 어떤 함수는 카멜 케이스인데 그 이유가 무엇인가요?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

추가적으로 이 함수는 왜 async 함수일까요??

Comment thread src/App.js
Comment on lines +3 to +4
function RandomAnswer() {
const CORRECT_ANSWER = [];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

해당 함수의 동작을 함수의 이름만 보고 유추하기에 편한 이름이라 생각되시나용??

Comment thread src/App.js
Comment on lines +16 to +17
let userInput;
let userAnswer;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 두 변수를 let으로 선언하신 이유가 무엇인가요?

let은 const, var과 무슨 차이를 갖고 있나요?

Comment thread src/App.js
Comment on lines +44 to +45
if (userAnswer[i] === CORRECT_ANSWER[i]) strike++;
else if (CORRECT_ANSWER.includes(userAnswer[i])) ball++;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

후위 증감과 전위 증감이 차이는 무엇일까요?

Comment thread src/App.js
let strike = 0;
let ball = 0;

for (let i = 0; i < 3; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

3이라는 상수를 매직 넘버로 사용하지 않고, 이를 개선하려면 어떻게 해야될까요?

Comment thread src/App.js
Comment on lines +40 to +41
let strike = 0;
let ball = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

요 부분도 let을 사용하신 이유가 무엇인가용?

Comment thread src/App.js
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 부분을 어떻게 개선할 수 있을까요?

Comment thread src/App.js
Comment on lines +72 to +75
if (strike === 3) {
Console.print('3개의 숫자를 모두 맞히셨습니다! 게임 종료');
break;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ealry return 패턴을 적용하면 어떤 장점과 단점이 생길까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants