I all, I can't figure out - in type comparison/test - why we usually use :
typeof variable === 'boolean'
...and never see this one :
typeof variable == 'boolean'
As it seems to me that typeof always returns a string value (the type name), I don't understand why we should test the type... of the type string ?
I guess it's just common practice, and it's idiomatic because triple equals compares the types as well; which makes more sense since you're interested in the type. But in practice you aren't going to see a difference in behaviour in this case. Also see this .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.