Match Ending String Patterns Pass Criteria not working

Match Ending String Patterns Pass Criteria not working
0.0 0

#1

Hello, World!
I’m having issues with the passing criteria for this challenge.
There is obviously a $ in my regex, but the criteria, “You should search for "caboose" with the dollar sign $ anchor in your regex.” is not allowing me to pass.
Any ideas?

The code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns


#2

Remove the parenthesis in lastRegex should work. Your code is also correct its just FCC was being nitpicky.
https://regex101.com/r/PL8J5B/1


#3

That worked, but before when I tried the regex without brackets before, it didn’t work.
A FCC glitch, I guess…