Boo who Challenge please help!

Tell us what’s happening:
Hi. i can’t figure why when i passed false as an argument to my function, it doesnt return me true, since false is a boolean. Where am I wrong there? I checked the answer but it’s a different method. I’d like to pass this test with an if else condition. THanks

Your code so far


function booWho(bool) {
  // What is the new fad diet for ghost developers? The Boolean.
  if (typeof bool === 'boolean') {
  return bool;
}
else {
  return false
}

}
booWho(null);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0.

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

If you call booWho(false) you are returning false even though false is a boolean.

1 Like

Is that a rule? How could i bypass this, so if i call boowho(false) it return me true?

Instead of returning the bool variable.
Return true in it’s place.

The problem you are having is that you are returning the variable bool, and when that variable holds false, you are getting false.

1 Like

Why don’t you try using the typeof approach?

function booWho(bool) {
    return typeof bool == 'boolean';
  }