Help for JS exercice "Use Bracket Notation to Find the NthtoLast Character in a String"

Help for JS exercice "Use Bracket Notation to Find the NthtoLast Character in a String"
0

#1

Tell us what’s happening:

Hi,

i’m stuck on this exercice…I tried different methods, to no avail.

Need some advice.

A character is a like a letter, so my code should work logically,.It’s the second character(letter) starting from the last one ,thereofre “length - 2”,non?

Your code so far

// Example
var firstName = "Ada";
var thirdToLastLetterOfFirstName = firstName[firstName.length - 3];

// Setup
var lastName = "Lovelace";

// Only change code below this line
var secondToLastLetterOfLastName = lastName;

var secondToLastCharacter = lastName[lastName.length - 2];




Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0.

Link to the challenge:


#2

The test that runs is looking for a variable named secondToLastLetterOfLastName. In your code above, you created a new variable called secondToLastCharacter and assigned it the second to last character. You can either correct the name on your last line of code or delete the last line and modify the original line with the correct code.