* 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 |
---|---|---|---|---|
56592a60ddddeae28f7aa8e1 | Access Multi-Dimensional Arrays With Indexes | 1 | 访问带索引的多维数组 |
Description
var arr = [注意
[1,2,3],
[4,5,6]
[7,8,9]
[[10,11,12],13,14]
]。
ARR [3]; //等于[[10,11,12],13,14]
ARR [3] [0]; //等于[10,11,12]
ARR [3] [0] [1]; //等于11
数组名称和方括号之间不应该有任何空格,如
array [0][0]
,甚至不允许使用此array [0] [0]
。尽管JavaScript能够正确处理,但这可能会让其他程序员在阅读代码时感到困惑。 Instructions
myArray
选择一个元素,使myData
等于8
。 Tests
tests:
- text: <code>myData</code>应该等于<code>8</code> 。
testString: assert(myData === 8);
- text: 您应该使用括号表示法从<code>myArray</code>读取正确的值。
testString: assert(/myData=myArray\[2\]\[1\]/.test(code.replace(/\s/g, '')));
Challenge Seed
// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
// Only change code below this line.
var myData = myArray[0][0];
After Test
console.info('after the test');
Solution
// solution required