Tianhe Gao

Boo who

  1. Basic Algorithm Scripting: Boo who | freeCodeCamp.org
  2. Boolean - JavaScript | MDN
  3. freeCodeCamp Challenge Guide: Boo who - Guide - The freeCodeCamp Forum

我写的

1function booWho(bool) {
2  if (bool === false || bool === true) {
3    return true
4  } else {
5    return false
6  }
7}
8
9console.log(booWho(1))

还可以这样写:

1function booWho(bool) {
2  return typeof bool === 'boolean'
3}
4
5console.log(booWho(1))

No notes link to this note

Welcome to tell me your thoughts via "email"
UP