본문 바로가기
알고리즘/Codewars

[Codewars] Convert a Number to a String! (8 kyu) / JavaScript

by fluss 2022. 10. 10.

https://www.codewars.com/kata/convert-a-number-to-a-string/

 

Codewars - Achieve mastery through coding practice and developer mentorship

Coding practice for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

We need a function that can transform a number (integer) into a string.

What ways of achieving this do you know?

 

Examples (input --> output):

123  --> "123"
999  --> "999"
-100 --> "-100"

 

설명:

숫자(정수)를 문자열로 바꾸는 함수가 필요합니다.

이것을 이루기위해 당신이 아는 방법은 무엇입니까?

 

예시 (입력 --> 출력):

123  --> "123"
999  --> "999"
-100 --> "-100"

 

풀이

function numberToString(num) {
  return String(num);
}

댓글