-
Notifications
You must be signed in to change notification settings - Fork 3
[Week 7] 황주희 #28
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
base: main
Are you sure you want to change the base?
[Week 7] 황주희 #28
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.
주석 너무 귀엽자나ㅠㅠㅠㅠㅠㅠ흑
let answer = []; | ||
|
||
let score = [ 0, 0, 0] | ||
let supo1 = [1,2,3,4,5] | ||
let supo2 = [2,1,2,3,2,4,2,5] | ||
let supo3 = [3,3,1,1,2,2,4,4,5,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.
요런 배열은 const로 선언하는게 조아여!!! 안전하게~.~
그른데 이제 제안할수 있는거느은 supo1,supo2, supo3보다는 supo로 하나의 배열 사용해서 이차원 쓸수도 있다아~.~
let supo3 = [3,3,1,1,2,2,4,4,5,5] | ||
|
||
|
||
for (var i = 0; i < answers.length; i++){ |
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.
var는 지양해주세여!! let 고고!!
} | ||
} | ||
|
||
let max_score = Math.max(...score) |
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.
변수이름은 !! lowerCamelCase
로!
maxScore
요기서는 값이 변하지 않으니까 const
로 쓰면 데게쮸?!
if (supo1[i] === answers[i]) score[0]++ | ||
if (supo2[i] === answers[i]) score[1]++ | ||
if (supo3[i] === answers[i]) score[2]++ | ||
|
||
if (i > supo1.length-1) { | ||
if(supo1[i%supo1.length] === answers[i]) score[0]++ | ||
} | ||
if (i > supo2.length-1) { | ||
if(supo2[i%supo2.length] === answers[i]) score[1]++ | ||
} | ||
if (i > supo3.length-1) { | ||
if(supo3[i%supo3.length] === answers[i]) score[2]++ | ||
} |
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.
그렇게 되면 요기 코드 반복되는 부분들을 줄일 수도 있겟져?!
✨ 푼 문제