Files
.github
api-server
client
config
curriculum
challenges
_meta
arabic
chinese
english
01-responsive-web-design
02-javascript-algorithms-and-data-structures
basic-algorithm-scripting
boo-who.english.md
chunky-monkey.english.md
confirm-the-ending.english.md
convert-celsius-to-fahrenheit.english.md
factorialize-a-number.english.md
falsy-bouncer.english.md
find-the-longest-word-in-a-string.english.md
finders-keepers.english.md
mutations.english.md
repeat-a-string-repeat-a-string.english.md
return-largest-numbers-in-arrays.english.md
reverse-a-string.english.md
slice-and-splice.english.md
title-case-a-sentence.english.md
truncate-a-string.english.md
where-do-i-belong.english.md
basic-data-structures
basic-javascript
debugging
es6
functional-programming
intermediate-algorithm-scripting
javascript-algorithms-and-data-structures-projects
object-oriented-programming
regular-expressions
03-front-end-libraries
04-data-visualization
05-apis-and-microservices
06-information-security-and-quality-assurance
08-coding-interview-prep
09-certificates
portuguese
russian
spanish
formattingConversion
math-challenges
requiresTests
schema
test
.babelrc
.editorconfig
.npmignore
.travis.yml
CHANGELOG.md
LICENSE.md
commitizen.config.js
commitlint.config.js
create-challenge-bundle.js
getChallenges.js
gulpfile.js
index.js
lib.js
md-translation.js
package-entry.js
package-lock.json
package.json
utils.js
docs
guide
mock-guide
tools
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.node-inspectorrc
.prettierrc
.snyk
.travis.yml
.vcmrc
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE.md
README.french.md
README.italian.md
README.md
docker-compose-shared.yml
docker-compose.yml
lerna.json
netlify.toml
package-lock.json
package.json
sample.env

83 lines
2.6 KiB
Markdown
Raw Normal View History

---
id: a77dbc43c33f39daa4429b4f
title: Boo who
isRequired: true
challengeType: 5
---
## Description
<section id='description'>
Check if a value is classified as a boolean primitive. Return true or false.
Boolean primitives are true and false.
Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>booWho(true)</code> should return true.
testString: assert.strictEqual(booWho(true), true, '<code>booWho(true)</code> should return true.');
- text: <code>booWho(false)</code> should return true.
testString: assert.strictEqual(booWho(false), true, '<code>booWho(false)</code> should return true.');
- text: <code>booWho([1, 2, 3])</code> should return false.
testString: assert.strictEqual(booWho([1, 2, 3]), false, '<code>booWho([1, 2, 3])</code> should return false.');
- text: <code>booWho([].slice)</code> should return false.
testString: assert.strictEqual(booWho([].slice), false, '<code>booWho([].slice)</code> should return false.');
- text: '<code>booWho({ "a": 1 })</code> should return false.'
testString: 'assert.strictEqual(booWho({ "a": 1 }), false, ''<code>booWho({ "a": 1 })</code> should return false.'');'
- text: <code>booWho(1)</code> should return false.
testString: assert.strictEqual(booWho(1), false, '<code>booWho(1)</code> should return false.');
- text: <code>booWho(NaN)</code> should return false.
testString: assert.strictEqual(booWho(NaN), false, '<code>booWho(NaN)</code> should return false.');
- text: <code>booWho("a")</code> should return false.
testString: assert.strictEqual(booWho("a"), false, '<code>booWho("a")</code> should return false.');
- text: <code>booWho("true")</code> should return false.
testString: assert.strictEqual(booWho("true"), false, '<code>booWho("true")</code> should return false.');
- text: <code>booWho("false")</code> should return false.
testString: assert.strictEqual(booWho("false"), false, '<code>booWho("false")</code> should return false.');
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function booWho(bool) {
// What is the new fad diet for ghost developers? The Boolean.
return bool;
}
booWho(null);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function booWho(bool) {
return typeof bool === "boolean";
}
booWho(null);
```
</section>