logo

Convert boolean values to strings

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

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


And that's the best solution among all users:

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