Basic JavaScript - Use Bracket Notation to Find the First Character in a String

plis help! I’m stuck here for hours.
it keeps on saying that i should the bracket notation. i checked other similar questions that were already answered on the forum but still i cant figure it out

// Setup
let firstLetterOfLastName = "";
const lastName = "Lovelace";
const firstLetter = lastName[0];

// Only change code below this line
firstLetterOfLastName = "L"; // 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/106.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Use Bracket Notation to Find the First Character in a String

Link to the challenge:

the instruction was to use the bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName. so the first character in lastName is L. I tried to put brackets around L and its saying undefined

It was to find the first character of the variable as the instruction said. i copied the example below. I just cant see where it went wrong
const firstName = “Charles”;
const firstLetter = firstName[0];


`firstLetter` would have a value of the string `C`.

Thanks a lot for your response. I solved it

firstLetterOfLastName = lastName[0];
this was the correct code. this is where i was wrong

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.