1.6 KiB
1.6 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
bd7123c9c450eddfaeb5bdef | Use Bracket Notation to Find the Nth Character in a String | 1 | 使用括号表示法查找字符串中的第N个字符 |
Description
0
开始计数,因此第一个字符实际上是第0个字符。 Instructions
thirdLetterOfLastName
设置为等于lastName
变量的第三个字母。 暗示 如果卡住,请尝试查看
secondLetterOfFirstName
变量声明。 Tests
tests:
- text: <code>thirdLetterOfLastName</code>变量的值应为<code>v</code> 。
testString: 'assert(thirdLetterOfLastName === "v", "The <code>thirdLetterOfLastName</code> variable should have the value of <code>v</code>.");'
- text: 您应该使用括号表示法。
testString: 'assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/), "You should use bracket notation.");'
Challenge Seed
// Example
var firstName = "Ada";
var secondLetterOfFirstName = firstName[1];
// Setup
var lastName = "Lovelace";
// Only change code below this line.
var thirdLetterOfLastName = lastName;
After Test
console.info('after the test');
Solution
// solution required