Tell us what’s happening:
Describe your issue in detail here.
I’m not sure why "boolean" passed as true and not any other string value. I typed in "bool", but it did not pass. A non-empty string is truthy, so it seems like it would pass. Does the string "boolean" have any inherent worth that I’m not aware of? Why can’t I just type any string and pass the test. Is there a relation between bool and "boolean" that is inherently truthy?
Thanks as always!
**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/96.0.4664.93 Safari/537.36
first of all, here you are not checking whether a value is truthy or not, but checking the value is a boolean, meaning true or false (Here i not meant truthy, bt boolean )
next lets see what is typeof is actually doing
typeof will return the data type of the value given
eg:
typeof 1 will return “number”
typeof “blah” will return “string”
typeof [1,2,3] will return “object”
typeof true will return “boolean”
typeof false will return “boolean”
so what happening in the function is you are checking the value of bool is whether a boolean (true or false not any truthy value)