Build a Boolean Check Function - Build a Boolean Check Function

Tell us what’s happening:

i don’t understand how all the paramaters are fullfiled

: 1. You should have a booWho function.

  • Waiting:2. booWho(true) should return true.
  • Waiting:3. booWho(false) should return true.
  • Waiting:4. booWho([1, 2, 3]) should return false.
  • Waiting:5. booWho([].slice) should return false.
  • Waiting:6. booWho({ "a": 1 }) should return false.
  • Waiting:7. booWho(1) should return false.
  • Waiting:8. booWho(NaN) should return false.
  • Waiting:9. booWho("a") should return false.
  • Waiting:10. booWho("true") should return false.
  • Waiting:11. booWho("false") should return false.

Your code so far

function booWho(argument) {
  if(argument === true) {
    return true;
  } else if(argument === false) {
    return true;
  } else if(argument === 1, 2, 3) {
    return false;
  }
}

Your browser information:

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

Challenge Information:

Build a Boolean Check Function - Build a Boolean Check Function

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-boolean-check/a77dbc43c33f39daa4429b4f.md at main · freeCodeCamp/freeCodeCamp · GitHub

it’s all about this

you should check what the value of argument === 1, 2, 3, put it in a console.log to check

i should change argument === 1, 2, 3 and use: argument === 1 || argument === 2 || argument === 3?

That won’t work, but i’m unable to see the console after i finish the code. It ends on the last line and don’t show anything else. That’s why i asked here, i was thinking it was a bug or something. I’m trying to see on vsCode but i’m doing something wrong, because i’m also unable to see the result on the console.

Okay, just fingured, i was consoling inside the function, so wasn’t showing me.
So i guess argument === 1, 2, 3 means that slice will be false, a : 1 also false, NaN also false, “a” also false, and “true” or “false” also false because it isn’t a text?

no, the result of argument === 1, 2, 3 is 3, sorry, console.log was a bad thing to suggest here, unless you write it as console.log((argument === 1, 2, 3))

image

so it means it is always a truthy value, and everything that fails the first two checks of argument === false and argument === true, will pass a else if (3) {

My function isn’t checking the value properly? I understand that i should check them separately, using && or ||, but everytime i try the answer is “1, 2, 3 should return false”, so only when i check like “argument === 1, 2, 3” i have an accurate answer.

i tried to console.log how you did, but is saying ‘argument is not defined’.

i’m not sure what am i doing wrong here, thought i know i should use || to separate them because i’m probably not checking 2 and 3, but when i try to do it it i fail the exercise.

I did just to check and console.log(2) or 3 returns false, and also console.log(1, 2, 3) but i need to call the function, i can’t console.log(argument === 1) or anything cause argument is not defined. Am i doing something so wrong that the exercise is bugging?

do you mean function booWho([1, 2, 3])? [1, 2, 3] is an array and is not the same thing as 1, 2, 3

you need to check inside the function where argument exists