Bool detector not working

Tell us what’s happening:
Describe your issue in detail here.

Everything except the 1st condition isnt working

  **Your code so far**

function booWho(bool) {
if(bool == true | bool == false && bool != 1){
  return true
}

else if(bool == 1){
  return false;
}
else{
  return false;
}
}

console.log(booWho(true));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62

Challenge: Boo who

Link to the challenge:

Nvm, I put strict equality operator and its working now.

Glad you were able to figure it out
You could simplify your solution by using the typeof operator :grinning:

1 Like

Sure!

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

booWho(null);

Terneraries work too but I was actually referring to typeof operator. :grinning:

Just something to look at for future challenges. :grinning:

1 Like