-
Notifications
You must be signed in to change notification settings - Fork 341
Bonfire Boo who
Rafael J. Rodriguez edited this page Jan 6, 2017
·
2 revisions
Created by Rafase282
Github | FreeCodeCamp | CodePen | LinkedIn | Website | E-Mail
- Difficulty: 2/5
Check if a value is classified as a boolean primitive. Return true or false.
Boolean primitives are true and false.
Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.
function boo(bool) {
// What is the new fad diet for ghost developers? The Boolean.
return bool;
}
boo(null);
- This program is very simple, the trick is to understand what a boolean primitive is. The programs requires a true or false answer.
- You will need to check for the type of the parameter to see if it is a boolean.
- To check for the type of a parameter, you can use
typeof
- Since you must return true or false you can use if statements or just have it return the boolean used for the if statement.
Solution ahead!
function boo(bool) {
// Uses the operator typeof to check if is a boolean
// if yes then return true, if it is another type then return false
return typeof bool === 'boolean';
}
- Read comments on code.
Thanks for visiting, if you like this please feel free to star my repo, follow me or even contact me about contributing as it will be a lot of work and having help would be cool.
- HTML5 and CSS
- Responsive Design with Bootstrap
- Gear up for Success
- jQuery
- Basic JavaScript
- Object Oriented and Functional Programming
- Basic Algorithm Scripting
- Basic Front End Development Projects
- Intermediate Algorithm Scripting
- JSON APIs and Ajax
- Intermediate Front End Development Projects
- Claim Your Front End Development Certificate
- Upper Intermediate Algorithm Scripting
- Automated Testing and Debugging
- Advanced Algorithm Scripting
- AngularJS (Legacy Material)
- Git
- Node.js and Express.js
- MongoDB
- API Projects
- Dynamic Web Applications
- Claim Your Back End Development Certificate
- Greefield Nonprofit Project 1
- Greefield Nonprofit Project 2
- Legacy Nonprofit Project 1
- Legacy Nonprofit Project 2
- Claim your Full Stack Development Certification
- Whiteboard Coding Interview Training
- Critical Thinking Interview Training
- Mock Interview 1
- Mock Interview 2
- Mock Interview 3