Tell us what’s happening:
I understand the point of the lesson is to create the correct code. However, it also says that the " The thirdLetterOfLastName
variable should have the value of v
." So I try to check it in the firefox console, and it comes back as undefined.
Is this because I am simply defining two variables, and not asking it to do anything with them?
When I add a third line, as in:
var lastName = "Lovelace";
var thirdLetterOfLastName = lastName[2];
thirdLetterOfLastName;
Then it does return a value of “v”.
So is my interpretation correct?
Your code so far
// Example
var firstName = "Ada";
var secondLetterOfFirstName = firstName[1];
// Setup
var lastName = "Lovelace";
// Only change code below this line.
var thirdLetterOfLastName = lastName[2];
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string