| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | --- | 
					
						
							|  |  |  | id: a77dbc43c33f39daa4429b4f | 
					
						
							|  |  |  | title: Boo who | 
					
						
							|  |  |  | challengeType: 5 | 
					
						
							| 
									
										
										
										
											2019-07-31 11:32:23 -07:00
										 |  |  | forumTopicId: 16000 | 
					
						
							| 
									
										
										
										
											2021-01-13 03:31:00 +01:00
										 |  |  | dashedName: boo-who | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | # --description--
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | Check if a value is classified as a boolean primitive. Return `true` or `false`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | Boolean primitives are `true` and `false`. | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | # --hints--
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho(true)` should return `true`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho(true), true); | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho(false)` should return `true`. | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho(false), true); | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho([1, 2, 3])` should return `false`. | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | assert.strictEqual(booWho([1, 2, 3]), false); | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho([].slice)` should return `false`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho([].slice), false); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho({ "a": 1 })` should return `false`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho({ a: 1 }), false); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho(1)` should return `false`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho(1), false); | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho(NaN)` should return `false`. | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho(NaN), false); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho("a")` should return `false`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho('a'), false); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho("true")` should return `false`. | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho('true'), false); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-02 16:12:12 -08:00
										 |  |  | `booWho("false")` should return `false`. | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | ```js | 
					
						
							|  |  |  | assert.strictEqual(booWho('false'), false); | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | # --seed--
 | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | ## --seed-contents--
 | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:02:05 +01:00
										 |  |  | ```js | 
					
						
							|  |  |  | function booWho(bool) { | 
					
						
							|  |  |  |   return bool; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | booWho(null); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # --solutions--
 | 
					
						
							| 
									
										
										
										
											2018-10-04 14:37:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```js | 
					
						
							|  |  |  | function booWho(bool) { | 
					
						
							|  |  |  |   return typeof bool === "boolean"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | booWho(null); | 
					
						
							|  |  |  | ``` |