[문자열 덧셈 계산기] 강하영 미션 제출합니다.#227
Open
Hayoung0708 wants to merge 16 commits intowoowacourse-precourse:mainfrom
Open
[문자열 덧셈 계산기] 강하영 미션 제출합니다.#227Hayoung0708 wants to merge 16 commits intowoowacourse-precourse:mainfrom
Hayoung0708 wants to merge 16 commits intowoowacourse-precourse:mainfrom
Conversation
iftype
reviewed
Oct 20, 2025
| } | ||
|
|
||
| /* 계산 및 결과 반환 */ | ||
| let answer = number.reduce((sum, num) => (sum += +num), 0); |
There was a problem hiding this comment.
let answer = number.reduce((sum, num) => (sum += Number(num)), 0);숫자 형변환을 하는 경우 Number(num) 으로 강제해야된다고 하네요..!
22.3 숫자: 형변환을 하는 경우 Number를 사용하고, 문자열을 파싱하는 경우에는 기수를 인자로 넘겨 parseInt를 사용하세요.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
구현한 기능
1. 문자열 입력
2. 쉼표(,), 콜론(:) 구분자를 기준으로 숫자 분리
3. 계산 및 결과 반환
4. 커스텀 구분자 추가
5. 예외 처리