Skip to main content

--description--

Check if a value is classified as a boolean primitive. Return true or false.

Boolean primitives are true and false.

--hints--

booWho(true) should return true.

assert.strictEqual(booWho(true), true);

booWho(false) should return true.

assert.strictEqual(booWho(false), true);

booWho([1, 2, 3]) should return false.

assert.strictEqual(booWho([1, 2, 3]), false);

booWho([].slice) should return false.

assert.strictEqual(booWho([].slice), false);

booWho({ "a": 1 }) should return false.

assert.strictEqual(booWho({ a: 1 }), false);

booWho(1) should return false.

assert.strictEqual(booWho(1), false);

booWho(NaN) should return false.

assert.strictEqual(booWho(NaN), false);

booWho("a") should return false.

assert.strictEqual(booWho('a'), false);

booWho("true") should return false.

assert.strictEqual(booWho('true'), false);

booWho("false") should return false.

assert.strictEqual(booWho('false'), false);

--seed--

--seed-contents--

function booWho(bool) {
return bool;
}

booWho(null);

--solutions--

function booWho(bool) {
return typeof bool === "boolean";
}

booWho(null);