CONSIDERING STARTING FROM 0, WHY WOULDNT THE CODE BELOW BE EQUAL TO “C”
PLEASE help
// Example
var firstName = "Ada";
var thirdToLastLetterOfFirstName = firstName[firstName.length - 3];
// Setup
var lastName = "Lovelace";
// Only change code below this line
var secondToLastLetterOfLastName = lastName;
var secondToLastLetterOfFLastName= lastName[lastName.length-2];
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
If lastName is "Lovelace", then var secondToLastLetterOfFLastName= lastName[lastName.length-2]; would create a variable named secondToLastLetterOfLastName and assign "c" to it. If you are encountering errors, it is probably because you declare secondToLastLetterOfLastName twice.