Boo who Task - Basic Algorithm Scripting

Tell us what’s happening:
What am I doing wrong?
All the conditions are getting passed except
1- booWho(false)` should return true.
2- booWho(1) should return false.

Your code so far


function booWho(bool) {
  if (bool == true || bool == false) {
    return bool
  }
  return false;
}

booWho(null);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who

Ok now I did a little change to the code

return true;
This solves one more condition that is
booWho(false)` should return true.

But still the second condition is not passing
1 is not equal to true or false so why isn’t it returning false

Hint: There is a difference between bool == true and bool === true.

The instructions are to return true if bool is true or false. And to return false if bool is anything that’s not true or false. As it is right now, if bool === false, it returns bool, which is false. And if bool === false, it should return true.

Be careful on the difference between == and ===

false == 0 // true
1 == true // true
false === 0 // false
true === 1 // false

More infos:

You can also look into the operator typeof