1.6 KiB
1.6 KiB
id, challengeType, videoUrl, forumTopicId, localeTitle
id | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|
bd7123c9c441eddfaeb5bdef | 1 | https://scrimba.com/c/c9Me8t4 | 301176 | 理解布尔值 |
Description
布尔
值要么是true
要么是false
。它非常像电路开关,true
是 “开”,false
是 “关”。这两种状态是互斥的。
注意布尔值
是不带引号的,"true"
和"false"
是字符串
而不是布尔值
,在 JavaScript 中也没有特殊含义。
Instructions
welcomeToBooleans
函数,让它返回true
而不是false
。
Tests
tests:
- text: <code>welcomeToBooleans()</code>函数应该返回一个布尔值 (true/false)。
testString: assert(typeof welcomeToBooleans() === 'boolean');
- text: <code>welcomeToBooleans()</code>应该返回 true。
testString: assert(welcomeToBooleans() === true);
Challenge Seed
function welcomeToBooleans() {
// Only change code below this line.
return false; // Change this line
// Only change code above this line.
}
After Test
welcomeToBooleans();
Solution
function welcomeToBooleans() {
return true; // Change this line
}