Conversation
kich555
approved these changes
Feb 8, 2025
| export const MIN_NUMBER = 1 | ||
| export const LIMIT_COUNT = 5 | ||
|
|
||
| export const PRINT = Object.freeze({ |
There was a problem hiding this comment.
👍👍👍 객체로 관리하는것, Object.freeze를 통해 객체 내부의 값들도 상수화 한 부분이 좋네요
Comment on lines
+10
to
+16
| "rules": { | ||
| "no-console": "off", | ||
| "no-use-before-define": "off", | ||
| "no-plusplus": "off", | ||
| "no-shadow": "off", | ||
| "import/prefer-default-export": "off" | ||
| }, |
There was a problem hiding this comment.
eslint를 조금 빡빡하게 ? 사용해보는 것도 좋을것 같아요
가령 airbnb 의 lint rule을 도입해본다던지
참고로 off 처리한 rule들은 리즈너블 해보입니다
Author
There was a problem hiding this comment.
넵 알겠습니다. Airbnb, standard와 같은 린트들을 적극 활용해보도록 하겠습니다 !
Comment on lines
1
to
17
| /** | ||
| * 게임에서 사용되는 최대 숫자 | ||
| * @constant | ||
| */ | ||
| export const MAX_NUMBER = 50 | ||
|
|
||
| /** | ||
| * 게임에서 사용되는 최소 숫자 | ||
| * @constant | ||
| */ | ||
| export const MIN_NUMBER = 1 | ||
|
|
||
| /** | ||
| * 숫자 추측 가능 횟수 제한 | ||
| * @constant | ||
| */ | ||
| export const LIMIT_COUNT = 5 |
src/index.js
Outdated
Comment on lines
4
to
6
| let prevInputList = [] | ||
| let playCount = 0 | ||
| let answer = getRandomNumber(1, 50) |
There was a problem hiding this comment.
전역변수가 현재 3개인데 이걸 하나의 상태로 묶어서 관리해보면 어떨까요?
가장 기본적으로는
const playState = {
prevInputList: [],
playCount: 0,
answer: getRandomNumber(1, 50)
}뭐 이런식으로요
Author
There was a problem hiding this comment.
객체로 그룹화하는 것이 하나의 상태로 보여져 더 좋아보이네요! 알겠습니다
Comment on lines
49
to
51
| function userInputValidation(value) { | ||
| return value >= MIN_NUMBER && value <= MAX_NUMBER | ||
| } |
There was a problem hiding this comment.
value로 문자열 등 숫자가 아닌 다른 값이 올때에 대한 방어코드도 있으면 좋을것 같네요
Author
There was a problem hiding this comment.
당연시하게 value에는 넘버가 들어온다고 생각했지만 안정적인 프로그래밍을 위해선 자바스크립트의 유연함을 제어해줄 필요가 있어보이네요. 이 부분은 JS를 작성하면서 인지하도록 하겠습니다.
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.
✅ 요구사항
📝 구현 내용
게임을 구현함에 있어, 중복 로직 관리 및 가독성을 고려하여 코드를 작성했습니다. 나름대로 기능 요구사항을 세세하게 나눠 작업을 했지만, 여전히 복잡하다고 느껴지네요. (개인적으로 가독성이 좋다는 느낌을 받지 못했습니다)