Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function booWho(bool) {
return typeof bool = "boolean";
}
booWho(null);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Challenge: Boo who
Link to the challenge:
It tells you in the second line of the instructions what a Boolean primitive is:
Boolean primitives are true
and false
.
There isn’t anything more to it than that, no further explanation is really necessary. Either the value true
or the value false
.
=
in JavaScript means “assign the value on the right hand side to the variable name on the left hand side” .
It doesn’t mean “left hand side equals right hand side” .
1 Like
Sometimes the simple ones can be puzzling.
The problem here is that you haven’t broken your work into two steps:
Check if a value is classified as a boolean primitive.
Return true
or false
.
try using an if else statement and return based on that.
Alternatively you can do it in one line but it requires the use of a trinary:
return typeof bool == ‘boolean’ ? true : false;
1 Like
Hey Man! Update here, I did more of a google search & came back to your solution & got it. Basically we have to check whether the arg passed is boolean or not. Thanks for your time [your real name ]
system
Closed
May 6, 2022, 2:47am
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.