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

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

by fluss 2022. 10. 12.

https://www.codewars.com/kata/551b4501ac0447318f0009cd

 

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:

Implement a function which convert the given boolean value into its string representation.

Note: Only valid inputs will be given.

 

설명:

주어진 불리언 값을 문자열 표현으로 바꾸는 함수를 구현하세요.

주의: 유효한 입력만 주어집니다.

 

풀이

function booleanToString(b){
  return b.toString();
}
 
toString으로 b를 문자열로 바꿔서 반환해준다.

댓글