* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.3 KiB
1.3 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bd7993c9c69feddfaeb8bdef | 使用 JavaScript 数组将多个值存储在一个变量中 | 1 | https://scrimba.com/c/crZQWAm | 18309 | store-multiple-values-in-one-variable-using-javascript-arrays |
--description--
使用数组
,我们可以在一个地方存储多个数据。
以左方括号[
开始定义一个数组,以右方括号]
结束,里面每个元素之间用逗号隔开,例如:
var sandwich = ["peanut butter", "jelly", "bread"]
.
--instructions--
创建一个包含字符串
和数字
的数组myArray
。
提示
如果你遇到困难,请参考文本编辑器中的示例代码。
--hints--
myArray
应该是一个数组
。
assert(typeof myArray == 'object');
myArray
数组的第一个元素应该是一个字符串
。
assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
myArray
数组的第二个元素应该是一个数字
。
assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
--seed--
--after-user-code--
(function(z){return z;})(myArray);
--seed-contents--
// Only change code below this line
var myArray = [];
--solutions--
var myArray = ["The Answer", 42];