Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
i agree for this solution. i'm never thinking this before. thanks
could add it but null undefined etc are not booleans
The idea is that booleans only have two values. true and false. If the entered boolean is true it outputs "Yes" if the entere boolean is false it outpits "no" There isnt even any calculation required here. It just directly returns Yes or No depending on whats entered.
Did it the same way
I don't think it matters. the logic behind a ternary operator is that if whatever before the "?" is true, then return yes:no, so using (bool === true) ? or bool ? is the same logic.
This comment is hidden because it contains spoiler information about the solution
This solution will convert truthy and falsy values into boolean unlike the solution which checks if it is strictly equal to true or false you guys must be careful of using this solution as it may cause a bug on your system
The kata description states that the function takes a boolean value. So checking the type is beyond the scope of this kata.
This comment is hidden because it contains spoiler information about the solution
Wow, this didn't even cross my mind. A real practical solution!
brevity is the soul of wit!!!
The values undefined, null, NaN, 0, "" (the empty string) and of course 'false' are so-called "falsy" values. This means that upon being used in a boolean operation, they will convert to false. To some it seems intuitive, to others dumb and/or arbitrary. In the end, it is just how the JavaScript language works. You can find further information on the MDN website.
same answer but top 1 is you,not fair
I completely omitted the basic mechanism of JS functions, that was the problem, which gave me the failed tests.
Keep your eyes open next time folks!
Oh my, really is it that simple. It is like puzzle where answer is in the question :)
Loading more items...