Solution returning undefined when tested in js console

My question is why does the correct answer for this challenge return a value of undefined when you test in in the console. im failing to wrap my head around that .I would appreciate an explanation for those willing to shed more light .Thanks

// Setup
var firstLetterOfLastName = “”;
var lastName = “Lovelace”;

// Only change code below this line
firstLetterOfLastName = lastName[0]; // Change this line





**Your browser information:**

User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36</code>

**Challenge:**  Use Bracket Notation to Find the First Character in a String

**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string

Could you please share your solution to that question, so we can debug it properly

@shiripindayeukai Your code works perfectly fine for me. I am not getting any undefined warning.

Hi there thank you very much for responding.I have come to realise that i had mixed up some parts when i was testing in the console. When i fixed them it returned the correct thing.Thank you !

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