Link Search Menu Expand Document

Match Ending String Patterns

Summary

  • $ is used to search for patterns at the end of a string.

Final Code

let caboose = "The last car on a train is the caboose";
let lastRegex = /caboose$/; // Change this line
let result = lastRegex.test(caboose);