Bracket notation是一种在字符串中的特定index处获取字符的方法。大多数现代编程语言,如JavaScript,都不像人类那样开始计算。它们从0开始。这称为基于零的索引。例如,单词“Charles”中索引0处的字符是“C”。因此,如果var firstName = "Charles" ,则可以使用firstName[0]获取字符串第一个字母的值。 lastName变量中的第一个字符并将其分配给firstLetterOfLastName 。 暗示 firstLetterOfFirstName变量声明。 firstLetterOfLastName变量的值应为L
testString: 'assert(firstLetterOfLastName === "L", "The firstLetterOfLastName variable should have the value of L.");'
- text: 您应该使用括号表示法。
testString: 'assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/), "You should use bracket notation.");'
```