Skip to content

Commit 25c544d

Browse files
feat: add boolean checker lab to full stack (freeCodeCamp#61433)
1 parent 3ee3a92 commit 25c544d

5 files changed

Lines changed: 139 additions & 0 deletions

File tree

client/i18n/locales/english/intro.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,6 +3105,12 @@
31053105
"In this workshop, you will review your knowledge of functions by building a calculator."
31063106
]
31073107
},
3108+
"lab-boolean-check": {
3109+
"title": "Build a Boolean Check Function",
3110+
"intro": [
3111+
"In this lab, you'll implement a function that checks if a value is a boolean."
3112+
]
3113+
},
31083114
"lab-email-masker": {
31093115
"title": "Build an Email Masker",
31103116
"intro": [
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Introduction to the Build a Boolean Check Function
3+
block: lab-boolean-check
4+
superBlock: full-stack-developer
5+
---
6+
7+
## Introduction to the Build a Boolean Check Function
8+
9+
In this lab, you'll implement a function that checks if a value is a boolean.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Build a Boolean Check Function",
3+
"isUpcomingChange": false,
4+
"dashedName": "lab-boolean-check",
5+
"superBlock": "full-stack-developer",
6+
"helpCategory": "JavaScript",
7+
"challengeOrder": [
8+
{
9+
"id": "a77dbc43c33f39daa4429b4f",
10+
"title": "Build a Boolean Check Function"
11+
}
12+
],
13+
"blockType": "lab",
14+
"blockLayout": "link",
15+
"usesMultifileEditor": true
16+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
id: a77dbc43c33f39daa4429b4f
3+
title: Build a Boolean Check Function
4+
challengeType: 26
5+
dashedName: build-a-boolean-check-function
6+
---
7+
8+
# --description--
9+
10+
In this lab you will build a function that check if a value is classified as a boolean primitive.
11+
12+
Boolean primitives are `true` and `false`.
13+
14+
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
15+
16+
**User Stories:**
17+
18+
1. You should have a function called `booWho` that receives one argument.
19+
1. If the argument received is a boolean primitive, the function should return `true`.
20+
1. If the argument is any other value, the function should return `false`.
21+
22+
# --hints--
23+
24+
You should have a `booWho` function.
25+
26+
```js
27+
assert.isFunction(booWho);
28+
```
29+
30+
`booWho(true)` should return `true`.
31+
32+
```js
33+
assert.isTrue(booWho(true));
34+
```
35+
36+
`booWho(false)` should return `true`.
37+
38+
```js
39+
assert.isTrue(booWho(false));
40+
```
41+
42+
`booWho([1, 2, 3])` should return `false`.
43+
44+
```js
45+
assert.isFalse(booWho([1, 2, 3]));
46+
```
47+
48+
`booWho([].slice)` should return `false`.
49+
50+
```js
51+
assert.isFalse(booWho([].slice));
52+
```
53+
54+
`booWho({ "a": 1 })` should return `false`.
55+
56+
```js
57+
assert.isFalse(booWho({ a: 1 }));
58+
```
59+
60+
`booWho(1)` should return `false`.
61+
62+
```js
63+
assert.isFalse(booWho(1));
64+
```
65+
66+
`booWho(NaN)` should return `false`.
67+
68+
```js
69+
assert.isFalse(booWho(NaN));
70+
```
71+
72+
`booWho("a")` should return `false`.
73+
74+
```js
75+
assert.isFalse(booWho('a'));
76+
```
77+
78+
`booWho("true")` should return `false`.
79+
80+
```js
81+
assert.isFalse(booWho('true'));
82+
```
83+
84+
`booWho("false")` should return `false`.
85+
86+
```js
87+
assert.isFalse(booWho('false'));
88+
```
89+
90+
# --seed--
91+
92+
## --seed-contents--
93+
94+
```js
95+
96+
```
97+
98+
# --solutions--
99+
100+
```js
101+
function booWho(bool) {
102+
return typeof bool === 'boolean';
103+
}
104+
105+
```

curriculum/superblock-structure/full-stack.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,9 @@
624624
{
625625
"dashedName": "workshop-calculator"
626626
},
627+
{
628+
"dashedName": "lab-boolean-check"
629+
},
627630
{
628631
"dashedName": "lab-email-masker"
629632
},

0 commit comments

Comments
 (0)