Files
2021-10-27 21:47:35 +05:30

61 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: bd7123c9c441eddfaeb5bdef
title: 理解布爾值
challengeType: 1
videoUrl: 'https://scrimba.com/c/c9Me8t4'
forumTopicId: 301176
dashedName: understanding-boolean-values
---
# --description--
另一種數據類型是布爾(<dfn>Boolean</dfn>)。 布爾值只能是兩個值中的一個:`true` 或者 `false`。 它非常像電路開關,`true` 是 “開”,`false` 是 “關”。 這兩種狀態是互斥的。
**注意:** 布爾值是不帶引號的。 字符串 `"true"``"false"` 不是布爾值,在 JavaScript 中也沒有特殊含義。
# --instructions--
修改 `welcomeToBooleans` 函數,當 run 按鈕點擊時讓它返回 `true` 而不是 `false`
# --hints--
`welcomeToBooleans()` 函數應該返回一個布爾值 `true` 或者 `false`)。
```js
assert(typeof welcomeToBooleans() === 'boolean');
```
`welcomeToBooleans()` 應該返回 `true`
```js
assert(welcomeToBooleans() === true);
```
# --seed--
## --after-user-code--
```js
welcomeToBooleans();
```
## --seed-contents--
```js
function welcomeToBooleans() {
// Only change code below this line
return false; // Change this line
// Only change code above this line
}
```
# --solutions--
```js
function welcomeToBooleans() {
return true; // Change this line
}
```