-
Notifications
You must be signed in to change notification settings - Fork 99
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
[22.04.28] 4문제 풀이추가, 1문제 주석수정(오타수정) #47
Conversation
Comment의 경우 주석의 오타(정답번호) 수정했습니다.
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이나 substr 등 권장되지 않는 문법이 눈에 띄었습니다!!
리뷰 내용 확인 후 (필요 시 수정) merge 부탁드립니다! 😁
level-1/자연수-뒤집어-배열로-만들기.js
Outdated
let slice = string.substr(i, 1) * 1; | ||
answer.push(slice); |
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.
🌱 웬만하면 반영해주세요. 🌱
substr
이 deprecated 된 것 은 아니지만 권장되지 않는 것 같습니다! slice
메서드를 사용해보시는 것은 어떨까요?
참고링크
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.
slice 사용한 풀이로 수정했습니다.
level-1/평균-구하기.js
Outdated
let sum = 0; | ||
for (var i = 0; i < arr.length; i++) { | ||
sum += arr[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.
🌱 반영해도 좋고 넘어가도 좋아요. 🌱
reduce 메서드를 사용해보시는 것은 어떨까요?
let sum = 0; | |
for (var i = 0; i < arr.length; i++) { | |
sum += arr[i]; | |
} | |
const sum = arr.reduce((acc,curr)=>acc+curr,0) |
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.
경현님 추천대로 수정하면 채린님 풀이와 너무 겹쳐서
삭제하고 좋은 방법 생기면 추가하도록 하겠습니다.
level-1/평균-구하기.js
Outdated
for (var i = 0; i < arr.length; i++) { | ||
sum += arr[i]; | ||
} | ||
return sum / 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의 호이스팅 덕분에 잘 작동하는 것 같지만, 권장되지 않습니다!
return sum / i; | |
return sum / arr.length; |
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으로 변경하면 정상작동 안합니다.
제가 파일을 삭제해서 문제가 생긴 것 같습니다. |
No description provided.