--- id: a77dbc43c33f39daa4429b4f challengeType: 5 videoUrl: '' title: 嘘谁 --- ## Description
检查参数是否归类为布尔基元。返回true或false。布尔基元是true和false。如果卡住,请记得使用Read-Search-Ask 。尝试配对程序。编写自己的代码。
## Instructions
## Tests
```yml tests: - text: booWho(true)应该返回true。 testString: assert.strictEqual(booWho(true), true); - text: booWho(false)应该返回true。 testString: assert.strictEqual(booWho(false), true); - text: 'booWho([1, 2, 3])应该返回false。' testString: assert.strictEqual(booWho([1, 2, 3]), false); - text: 'booWho([].slice)应该返回false。' testString: assert.strictEqual(booWho([].slice), false); - text: 'booWho({ "a": 1 })应该返回false。' testString: 'assert.strictEqual(booWho({ "a": 1 }), false);' - text: booWho(1)应该返回false。 testString: assert.strictEqual(booWho(1), false); - text: booWho(NaN)应该返回false。 testString: assert.strictEqual(booWho(NaN), false); - text: booWho("a")应该返回false。 testString: assert.strictEqual(booWho("a"), false); - text: booWho("true")应该返回false。 testString: assert.strictEqual(booWho("true"), false); - text: booWho("false")应该返回false。 testString: assert.strictEqual(booWho("false"), false); ```
## Challenge Seed
```js function booWho(bool) { // What is the new fad diet for ghost developers? The Boolean. return bool; } booWho(null); ```
## Solution
```js function booWho(bool) { return typeof bool === "boolean"; } booWho(null); ``` /section>