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

Use Bracket Notation to Find the First Character in a String


Hints

Hint 1

Remember that the first character of a string is at the zero-th position. For example:

var str = "Hello";
var letter = str[0]; // This equals "H"

For this exercise is necessary use the bracket notation

for exemple
// Example
var firstLetterOfFirstName = “”;
var firstName = “Ada”;

firstLetterOfFirstName = firstName[0];

The Answer is = “A”

\the Answer of this exercise

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

// Only change code below this line
firstLetterOfLastName = lastName;

firstLetterOfLastName = lastName[0]; —> the bracket notation use the var LastName to found letters;

1 Like

This is what I got

var firstLetterOfLastName = “lastName”;

var firstLetterOfLastName = lastName[0];

1 Like