Link Search Menu Expand Document

Use Bracket Notation to Find the First Character in a String

Summary

  • Most programming languages start at zero when counting.
  • Bracket notation is a way to get a character at a specific index within a string.

Final Code

// Setup
var firstLetterOfLastName = "";
var lastName = "Lovelace";

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