Exotic
1
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:
Exotic
2
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
1 Like
Exotic
4
Sure!
function booWho(bool) {
return (bool === true | bool === false) ? true : false;
}
booWho(null);
Terneraries work too but I was actually referring to typeof operator.
Just something to look at for future challenges.
1 Like
system
Closed
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.