Link Search Menu Expand Document

Use Bracket Notation to Find the Last Character in a String

Summary

  • In order to get the last letter of a string, subtract one from the string’s length.

Final Code

// Setup
var lastName = "Lovelace";

// Only change code below this line
var lastLetterOfLastName = lastName[lastName.length-1]; // Change this line