--- id: bd7123c9c450eddfaeb5bdef title: Use Bracket Notation to Find the Nth Character in a String challengeType: 1 videoUrl: 'https://scrimba.com/c/cWPVJua' forumTopicId: 18343 --- ## Description
You can also use bracket notation to get the character at other positions within a string. Remember that computers start counting at 0, so the first character is actually the zeroth character.
## Instructions
Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable using bracket notation. Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck.
## Tests
```yml tests: - text: The thirdLetterOfLastName variable should have the value of v. testString: assert(thirdLetterOfLastName === 'v'); - text: You should use bracket notation. testString: assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/)); ```
## Challenge Seed
```js // Example var firstName = "Ada"; var secondLetterOfFirstName = firstName[1]; // Setup var lastName = "Lovelace"; // Only change code below this line. var thirdLetterOfLastName = lastName; ```
### After Test
```js (function(v){return v;})(thirdLetterOfLastName); ```
## Solution
```js var lastName = "Lovelace"; var thirdLetterOfLastName = lastName[2]; ```