Tell us what’s happening:
I’ve finished my code, but I get a error at step 7. I don’t see anything wrong. Maybe someone could help me?
// running tests
7. booWho(1) should return false.
// tests completed
This is the error.
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;
}
else if(argument == booWho.slice()){
return false;
}
else if(argument == "a" || 1){
return false;
}
// this step
else if(argument == 1){
return false;
}
else if(argument == NaN){
return false;
}
else if(argument == "a"){
return false;
}
else if(argument == "true"){
return false;
}
else if(argument == "false"){
return false;
}
else {
return "false";
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
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
Hi @LamarSt
Check how you are using the “OR” operator.
Also, check what the comparison for the first if statement is checking.
Happy coding
I tried console logging the first statement but it doesnt give me any output. It’s just running the test and completing it. And for the OR statement. I couldnt find another way of using the OR operator. Any help appreciated.
ILM
May 28, 2026, 3:33pm
4
the way you are checking is not going to work
first, let me point out a couple of things:
LamarSt:
argument == 1,2,3
there are three separate statements here, argument == 1 is one, then there is 2 and there is 3, you are not checking argument against 2 and 3 here
booWho is your function, why are you using slice on it?
LamarSt:
argument == "a" || 1
here you are writing argument == "a" OR 1, the 1 is not being checked against argument
now, about ==
You are using == to compare your argument against many things
but…
true == 1 // true
NaN == NaN // false
is there maybe an other comparison operator that is more strict than this?
but that will not help with NaN == NaN being false
suggested review:
This was my problem. Thank you so much
I changed all == to === for a stricter check.
Solution:
now, about ==
You are using == to compare your argument against many things
but…
true == 1 // true
NaN == NaN // false
is there maybe an other comparison operator that is more strict than this?
but that will not help with NaN == NaN being false