* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
1.8 KiB
1.8 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244a8 | Storing Values with the Assignment Operator | 1 | 使用赋值运算符存储值 |
Description
myVariable = 5;
这将Number
值5
分配给myVariable
。作业总是从右到左。在将值分配给运算符左侧的变量之前,将解析=
运算符右侧的所有内容。 myVar = 5;这将为
myNum = myVar;
myVar
分配5
,然后再次将myVar
解析为5
并将其分配给myNum
。 Instructions
7
分配给变量a
。分配的内容a
变量b
。 Tests
tests:
- text: 不要更改行上方的代码
testString: assert(/var a;/.test(code) && /var b = 2;/.test(code));
- text: <code>a</code>的值应为7
testString: assert(typeof a === 'number' && a === 7);
- text: <code>b</code>的值应为7
testString: assert(typeof b === 'number' && b === 7);
- text: <code>a</code>应分配给<code>b</code> <code>=</code>
testString: assert(/b\s*=\s*a\s*;/g.test(code));
Challenge Seed
// Setup
var a;
var b = 2;
// Only change code below this line
Before Test
if (typeof a != 'undefined') {
a = undefined;
}
if (typeof b != 'undefined') {
b = undefined;
}
After Test
console.info('after the test');
Solution
// solution required