feat: add boolean checker lab to full stack (#61433)

This commit is contained in:
Ilenia
2025-07-25 16:06:21 +02:00
committed by GitHub
parent 3ee3a928a9
commit 25c544d620
5 changed files with 139 additions and 0 deletions
+6
View File
@@ -3105,6 +3105,12 @@
"In this workshop, you will review your knowledge of functions by building a calculator."
]
},
"lab-boolean-check": {
"title": "Build a Boolean Check Function",
"intro": [
"In this lab, you'll implement a function that checks if a value is a boolean."
]
},
"lab-email-masker": {
"title": "Build an Email Masker",
"intro": [
@@ -0,0 +1,9 @@
---
title: Introduction to the Build a Boolean Check Function
block: lab-boolean-check
superBlock: full-stack-developer
---
## Introduction to the Build a Boolean Check Function
In this lab, you'll implement a function that checks if a value is a boolean.
@@ -0,0 +1,16 @@
{
"name": "Build a Boolean Check Function",
"isUpcomingChange": false,
"dashedName": "lab-boolean-check",
"superBlock": "full-stack-developer",
"helpCategory": "JavaScript",
"challengeOrder": [
{
"id": "a77dbc43c33f39daa4429b4f",
"title": "Build a Boolean Check Function"
}
],
"blockType": "lab",
"blockLayout": "link",
"usesMultifileEditor": true
}
@@ -0,0 +1,105 @@
---
id: a77dbc43c33f39daa4429b4f
title: Build a Boolean Check Function
challengeType: 26
dashedName: build-a-boolean-check-function
---
# --description--
In this lab you will build a function that check if a value is classified as a boolean primitive.
Boolean primitives are `true` and `false`.
**Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab.
**User Stories:**
1. You should have a function called `booWho` that receives one argument.
1. If the argument received is a boolean primitive, the function should return `true`.
1. If the argument is any other value, the function should return `false`.
# --hints--
You should have a `booWho` function.
```js
assert.isFunction(booWho);
```
`booWho(true)` should return `true`.
```js
assert.isTrue(booWho(true));
```
`booWho(false)` should return `true`.
```js
assert.isTrue(booWho(false));
```
`booWho([1, 2, 3])` should return `false`.
```js
assert.isFalse(booWho([1, 2, 3]));
```
`booWho([].slice)` should return `false`.
```js
assert.isFalse(booWho([].slice));
```
`booWho({ "a": 1 })` should return `false`.
```js
assert.isFalse(booWho({ a: 1 }));
```
`booWho(1)` should return `false`.
```js
assert.isFalse(booWho(1));
```
`booWho(NaN)` should return `false`.
```js
assert.isFalse(booWho(NaN));
```
`booWho("a")` should return `false`.
```js
assert.isFalse(booWho('a'));
```
`booWho("true")` should return `false`.
```js
assert.isFalse(booWho('true'));
```
`booWho("false")` should return `false`.
```js
assert.isFalse(booWho('false'));
```
# --seed--
## --seed-contents--
```js
```
# --solutions--
```js
function booWho(bool) {
return typeof bool === 'boolean';
}
```
@@ -624,6 +624,9 @@
{
"dashedName": "workshop-calculator"
},
{
"dashedName": "lab-boolean-check"
},
{
"dashedName": "lab-email-masker"
},