- Basic Algorithm Scripting: Boo who | freeCodeCamp.org
- Boolean - JavaScript | MDN
- freeCodeCamp Challenge Guide: Boo who - Guide - The freeCodeCamp Forum
我写的
function booWho(bool) {
if (bool === false || bool === true) {
return true
} else {
return false
}
}
console.log(booWho(1))
还可以这样写:
function booWho(bool) {
return typeof bool === 'boolean'
}
console.log(booWho(1))