Can someone help me out

Tell us what’s happening:

Your code so far


// Setup
var lastName = "Lovelace";

// Only change code below this line
var secondToLastLetterOfLastName = lastName[lastName.lenght - 2]; // 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/83.0.4103.61 Safari/537.36.

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

Link to the challenge:

Its pretty straightforward actually syntax is to get specific index value such as:

“Hello World” so you want to only get W so you tell the position of that letter you can directly put 5 or you can put mathematically express like 10 - 5 .length returns total length of string.

So you can apply such mathematically expression to get your desire index.

Check your spelling.

1 Like