Convert boolean values to strings 'Yes' or 'No'.

Instructions: Complete the method that takes a boolean value and return a "Yes" string for true, or a "No" string for false. Thoughts: I used a ternary operator to cheek if the parameter is true. If it is the function will return 'Yes', otherwise it will return 'No'. Solution: function boolToWord( bool ){ return bool === true ? 'Yes' :'No'; } This is a CodeWars Challenge of 8kyu Rank (https://www.codewars.com/kata/53369039d7ab3ac506000467/train/javascript)

Apr 22, 2025 - 05:35
 0
Convert boolean values to strings 'Yes' or 'No'.

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

Thoughts:
I used a ternary operator to cheek if the parameter is true. If it is the function will return 'Yes', otherwise it will return 'No'.

Solution:
function boolToWord( bool ){
return bool === true ? 'Yes' :'No';
}

This is a CodeWars Challenge of 8kyu Rank (https://www.codewars.com/kata/53369039d7ab3ac506000467/train/javascript)