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

level01. x만큼 간격이 있는 n개의 숫자 #443

Merged
merged 1 commit into from
Mar 26, 2022

Conversation

JiaLee0707
Copy link
Collaborator

2022.03.25
https://programmers.co.kr/learn/courses/30/lessons/12954

for문을 사용하지 않고 푸는 방법은 없나 찾아보다가 Array() 생성자로 배열을 생성하는 방법을 사용해봤습니다!
for문의 성능이 더 좋다는 말도 있지만 코드는 확실히 짧아지네요...ㅎㅎ

참고사이트: https://stackoverflow.com/questions/3746725/how-to-create-an-array-containing-1-n

Copy link
Collaborator

@Leemainsw Leemainsw left a comment

Choose a reason for hiding this comment

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

코드가 되게 간단하게 짜였네요! 👍

Copy link
Member

@areumsheep areumsheep left a comment

Choose a reason for hiding this comment

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

확실히 for문을 쓰지 않으니 깔끔해지고 좋네요!
더 나은 방법이 없을까 고민했던 내용을 함께 공유해주셔서 감사합니다~

@@ -0,0 +1,3 @@
function solution(x, n) {
return [...Array(n).keys()].map((value) => x * (value + 1))
Copy link
Member

Choose a reason for hiding this comment

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

value 피드백이 반영된 내용 너무 좋네요! 이 값이 어떤 값인지 확실히 눈에 잘 보이는 것 같아요.

@JiaLee0707 JiaLee0707 merged commit daf1dc7 into master Mar 26, 2022
@SSSOy SSSOy deleted the JiaLee0707-patch-3 branch March 28, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants