Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

yongchanson
Copy link
Contributor

No description provided.

@yongchanson yongchanson changed the title [22.04.27] 4문제 풀이추가, 1문제 주석수정(오타수정) [22.04.28] 4문제 풀이추가, 1문제 주석수정(오타수정) Apr 27, 2022
Copy link
Owner

@codeisneverodd codeisneverodd left a comment

Choose a reason for hiding this comment

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

풀이 잘 보았습니다! 이번 풀이들에서는 var이나 substr 등 권장되지 않는 문법이 눈에 띄었습니다!!
리뷰 내용 확인 후 (필요 시 수정) merge 부탁드립니다! 😁

Comment on lines 62 to 63
let slice = string.substr(i, 1) * 1;
answer.push(slice);
Copy link
Owner

Choose a reason for hiding this comment

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

🌱 웬만하면 반영해주세요. 🌱

substr이 deprecated 된 것 은 아니지만 권장되지 않는 것 같습니다! slice 메서드를 사용해보시는 것은 어떨까요?
참고링크

Copy link
Contributor Author

Choose a reason for hiding this comment

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

slice 사용한 풀이로 수정했습니다.

Comment on lines 36 to 39
let sum = 0;
for (var i = 0; i < arr.length; i++) {
sum += arr[i];
}
Copy link
Owner

Choose a reason for hiding this comment

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

🌱 반영해도 좋고 넘어가도 좋아요. 🌱

reduce 메서드를 사용해보시는 것은 어떨까요?

Suggested change
let sum = 0;
for (var i = 0; i < arr.length; i++) {
sum += arr[i];
}
const sum = arr.reduce((acc,curr)=>acc+curr,0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

경현님 추천대로 수정하면 채린님 풀이와 너무 겹쳐서
삭제하고 좋은 방법 생기면 추가하도록 하겠습니다.

for (var i = 0; i < arr.length; i++) {
sum += arr[i];
}
return sum / i;
Copy link
Owner

Choose a reason for hiding this comment

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

🌱 웬만하면 반영해주세요. 🌱

var의 호이스팅 덕분에 잘 작동하는 것 같지만, 권장되지 않습니다!

Suggested change
return sum / i;
return sum / arr.length;

Copy link
Contributor Author

@yongchanson yongchanson Apr 28, 2022

Choose a reason for hiding this comment

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

호이스팅 이용하는게 제 의도였는데
권장되지 않는 사항이라면 빼겠습니다!
참고로 let으로 변경하면 정상작동 안합니다.

@yongchanson yongchanson reopened this Apr 28, 2022
@yongchanson
Copy link
Contributor Author

yongchanson commented Apr 28, 2022

제가 파일을 삭제해서 문제가 생긴 것 같습니다.
다시 살리는 방법을 모르겠는데
다시 풀리퀘스트를 하는게 좋을까요?

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.

2 participants