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:
https://www.freecodecamp.org/challenges/use-bracket-notation-to-find-the-nthtolast-character-in-a-string