.Use Bracket Notation to Find the Last Character in a String

Tell us what’s happening:

i tried changing that it tstill complains about the last letter e

Your code so far


// Example
var firstName = "Ada";
var lastLetterOfFirstName = firstName[firstName.length - 1];

// Setup
var lastName = "Lovelace";

// Only change code below this line.
var lastLetterOfLastName = "Lovelace";
var lastLetterOfFirstName = lastLetterOfFirstName[lastLetterOfFirstName.length - 1];


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string/

never mind got my mistake thanks

Hi
you need only to declare a variable called lastLetterOfLastName that have the same functionality as lastLetterOfFirstName but on last name variable.

don’t say you got it without giving us the answere u found as well…

Hint
Try looking at the lastLetterOfFirstName variable declaration if you get stuck.
they give us most of the code already u just have to alter the words

var lastLetterOfLastName = lastName[lastName.length - ];

now comes the hardest part of this lesson
Lovelace
we need to get the e
since we enter our code last name where reading backwards without the 0
Lovel a c e
^^^^^ ^ ^ ^
3 2 1
so we need the 1 = e

var lastLetterOfLastName = lastName[lastName.length - 1];