πŸ“

Number to String

Number to String
μž…λ¬Έ 기초 문법 +5pts

Problem

Write a function that converts a number to a string.

Examples

Input: numToString(123)
Output: "123"

Explanation

이 λ¬Έμ œλŠ” **νƒ€μž… λ³€ν™˜(Type Conversion)**을 ν•™μŠ΅ν•©λ‹ˆλ‹€. 숫자λ₯Ό λ¬Έμžμ—΄λ‘œ λ³€ν™˜ν•˜λŠ” μ—¬λŸ¬ 방법을 μ•Œμ•„λ΄…λ‹ˆλ‹€. **String() ν•¨μˆ˜** μ–΄λ–€ 값이든 λ¬Έμžμ—΄λ‘œ λ³€ν™˜ν•©λ‹ˆλ‹€: - String(123) β†’ "123" - String(true) β†’ "true" - String(null) β†’ "null" **toString() λ©”μ„œλ“œ** 숫자 값에 직접 ν˜ΈμΆœν•  수 μžˆμŠ΅λ‹ˆλ‹€: - (123).toString() β†’ "123" - num.toString() β†’ "123" **ν…œν”Œλ¦Ώ λ¦¬ν„°λŸ΄** 빈 ν…œν”Œλ¦Ώμ— 넣어도 λ¬Έμžμ—΄μ΄ λ©λ‹ˆλ‹€...

View detailed explanation β†’

Key Concepts

String() ν•¨μˆ˜ toString() λ©”μ„œλ“œ νƒ€μž… λ³€ν™˜ 진법 λ³€ν™˜
Time: O(log n) Space: O(log n)
solution.js
Ctrl + Enter
Run tests to see results here.