Tell us what’s happening:
I used a regex to solve this, but I keep getting an error saying testRegex.test is not a function. I read the help and understand the other method, but am also curious - what am I doing wrong with the regex usage?
Your code so far
function confirmEnding(str, target) {
let testRegex = '/' + target + '$/';
return testRegex.test(str);
}
confirmEnding("Bastian", "n");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
.
Link to the challenge: