Convert a Boolean to a String

Lee·2022년 7월 22일

Algorithm

목록 보기
55/92
post-thumbnail

❓ Convert a Boolean to a String

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

Note: Only valid inputs will be given.

✔ Solution

//#my solution
function booleanToString(b){
  //your code here
  return b ? "true" : "false"
}


//other solution
function booleanToString(b){
  return b.toString();
}
profile
Lee

0개의 댓글