-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[이동현] up nd down 구현 #9
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체적으로 깔끔하고 좋은것 같습니다 . 고생하셨어요
@@ -1,3 +1,14 @@ | |||
export const MAX_NUMBER = 50 | |||
export const MIN_NUMBER = 1 | |||
export const LIMIT_COUNT = 5 | |||
|
|||
export const PRINT = Object.freeze({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍👍 객체로 관리하는것, Object.freeze
를 통해 객체 내부의 값들도 상수화 한 부분이 좋네요
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint를 조금 빡빡하게 ? 사용해보는 것도 좋을것 같아요
가령 airbnb
의 lint rule을 도입해본다던지
참고로 off
처리한 rule들은 리즈너블 해보입니다
/** | ||
* 게임에서 사용되는 최대 숫자 | ||
* @constant | ||
*/ | ||
export const MAX_NUMBER = 50 | ||
|
||
/** | ||
* 게임에서 사용되는 최소 숫자 | ||
* @constant | ||
*/ | ||
export const MIN_NUMBER = 1 | ||
|
||
/** | ||
* 숫자 추측 가능 횟수 제한 | ||
* @constant | ||
*/ | ||
export const LIMIT_COUNT = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개인적으로 주석이 전체적으로 조금 과한것 같군요 😅
let prevInputList = [] | ||
let playCount = 0 | ||
let answer = getRandomNumber(1, 50) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전역변수가 현재 3개인데 이걸 하나의 상태로 묶어서 관리해보면 어떨까요?
가장 기본적으로는
const playState = {
prevInputList: [],
playCount: 0,
answer: getRandomNumber(1, 50)
}
뭐 이런식으로요
function userInputValidation(value) { | ||
return value >= MIN_NUMBER && value <= MAX_NUMBER | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value로 문자열 등 숫자가 아닌 다른 값이 올때에 대한 방어코드도 있으면 좋을것 같네요
✅ 요구사항
📝 구현 내용
게임을 구현함에 있어, 중복 로직 관리 및 가독성을 고려하여 코드를 작성했습니다. 나름대로 기능 요구사항을 세세하게 나눠 작업을 했지만, 여전히 복잡하다고 느껴지네요. (개인적으로 가독성이 좋다는 느낌을 받지 못했습니다)