--- id: bd7123c9c451eddfaeb5bdef title: Use Bracket Notation to Find the Last Character in a String challengeType: 1 videoUrl: '' localeTitle: Use a notação de suporte para localizar o último caractere em uma string --- ## Description
Para obter a última letra de uma string, você pode subtrair uma da extensão da string. Por exemplo, se var firstName = "Charles" , você pode obter o valor da última letra da string usando firstName[firstName.length - 1] .
## Instructions
Use a notação de colchetes para encontrar o último caractere na variável lastName . Sugestão
Tente ver a declaração da variável lastLetterOfFirstName se você ficar preso.
## Tests
```yml tests: - text: lastLetterOfLastName deve ser "e". testString: 'assert(lastLetterOfLastName === "e", "lastLetterOfLastName should be "e".");' - text: Você tem que usar o .length para obter a última letra. testString: 'assert(code.match(/\.length/g).length === 2, "You have to use .length to get the last letter.");' ```
## Challenge Seed
```js // Example var firstName = "Ada"; var lastLetterOfFirstName = firstName[firstName.length - 1]; // Setup var lastName = "Lovelace"; // Only change code below this line. var lastLetterOfLastName = lastName; ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```