72 lines
1.8 KiB
Markdown
72 lines
1.8 KiB
Markdown
|
---
|
||
|
id: bd7123c9c441eddfaeb5bdef
|
||
|
title: Understanding Boolean Values
|
||
|
challengeType: 1
|
||
|
---
|
||
|
|
||
|
## Description
|
||
|
<section id='description'>
|
||
|
Another data type is the <dfn>Boolean</dfn>. <code>Booleans</code> may only be one of two values: <code>true</code> or <code>false</code>. They are basically little on-off switches, where <code>true</code> is "on" and <code>false</code> is "off." These two states are mutually exclusive.
|
||
|
<strong>Note</strong><br><code>Boolean</code> values are never written with quotes. The <code>strings</code> <code>"true"</code> and <code>"false"</code> are not <code>Boolean</code> and have no special meaning in JavaScript.
|
||
|
</section>
|
||
|
|
||
|
## Instructions
|
||
|
<section id='instructions'>
|
||
|
Modify the <code>welcomeToBooleans</code> function so that it returns <code>true</code> instead of <code>false</code> when the run button is clicked.
|
||
|
</section>
|
||
|
|
||
|
## Tests
|
||
|
<section id='tests'>
|
||
|
|
||
|
```yml
|
||
|
- text: 'The <code>welcomeToBooleans()</code> function should return a boolean (true/false) value.'
|
||
|
testString: 'assert(typeof welcomeToBooleans() === "boolean", "The <code>welcomeToBooleans()</code> function should return a boolean (true/false) value.");'
|
||
|
- text: <code>welcomeToBooleans()</code> should return true.
|
||
|
testString: 'assert(welcomeToBooleans() === true, "<code>welcomeToBooleans()</code> should return true.");'
|
||
|
|
||
|
```
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Challenge Seed
|
||
|
<section id='challengeSeed'>
|
||
|
|
||
|
<div id='js-seed'>
|
||
|
|
||
|
```js
|
||
|
function welcomeToBooleans() {
|
||
|
|
||
|
// Only change code below this line.
|
||
|
|
||
|
return false; // Change this line
|
||
|
|
||
|
// Only change code above this line.
|
||
|
}
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
### After Test
|
||
|
<div id='js-teardown'>
|
||
|
|
||
|
```js
|
||
|
console.info('after the test');
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Solution
|
||
|
<section id='solution'>
|
||
|
|
||
|
|
||
|
```js
|
||
|
function welcomeToBooleans() {
|
||
|
return true; // Change this line
|
||
|
}
|
||
|
```
|
||
|
|
||
|
</section>
|