Basic JavaScript - Use Bracket Notation to Find the Last Character in a String

Tell us what’s happening:
please I need help, I cant seem to get through this. what’s wrong with my answer pls?

Your code so far

// Setup
const lastName = "Lovelace";

// Only change code below this line
const lastLetterOfLastName = lastName[lastName.length - 7]; // Change this line

Your browser information:

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

Challenge: Basic JavaScript - Use Bracket Notation to Find the Last Character in a String

Link to the challenge:

lastName[lastName.length - 7] is the same as lastName[8 - 7] which is lastName[1] which is "o".

“o” is the second letter. You need to get “e”, the last letter.

1 Like

thanks got it already

// Setup
const lastName = “Lovelace”;

// Only change code below this line
const lastLetterOfLastName = lastName[lastName.length - 1]; // Change this line