Tell us what’s happening:
Hi guys,
I don’t understand why this code does not work. To my understanding $
is an expression that let me match any RegExp at the end of the string. So why this code returns false? Thanks!
Your code so far
function confirmEnding(str, target) {
var regex = /(target)$/;
var evaluate = regex.test(str);
return evaluate;
}
confirmEnding("Bastian", "n"); //returns false
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
.
Challenge: Confirm the Ending
Link to the challenge: