Javascript: Add hint to Match Ending String Patterns (#19232)

* Javascript: Add hint to Match Ending String Patterns

Add hint to Match Ending String Patterns (https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns and https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns/)

* Update index.md
This commit is contained in:
greggubarev
2018-10-16 08:21:19 +04:00
committed by Quincy Larson
parent f4ad0419d9
commit 848458b142

View File

@ -1,10 +1,17 @@
---
title: Match Ending String Patterns
---
## Match Ending String Patterns
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
We need to use the anchor character (```$```) to match the string ```"caboose"``` at the end of the string ```caboose```.
## Solution:
```js
let caboose = "The last car on a train is the caboose";
let lastRegex = /caboose$/; // Change this line
let result = lastRegex.test(caboose);
```