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

[Codewars] Convert boolean values to strings 'Yes' or 'No'. (8 kyu) / JavaScript

by fluss 2022. 10. 1.

https://www.codewars.com/kata/53369039d7ab3ac506000467

 

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:

Complete the method that takes a boolean value and return a "Yes" string for true, or a "No" string for false.

 

설명:

boolean 값을 받아 true이면 "Yes" 문자열을 false이면 "No" 문자열을 반환하는 메소드를 완성하세요.

 

풀이

function boolToWord( bool ){
  if(bool) return "Yes"
  else return "No"
}

댓글