Hello, can comeone, please, explain, why my solution does not work? I tried different variations of syntax but the problem, I think, is with chosen method itself. This looks quite logical to me, but why doesn’t it work?
My code so far
function confirmEnding(str, target) {
var trg = /target$/i;
if (trg.test(str) == true) {
return true
} else {
return false
}
}
confirmEnding("Bastian", "n");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.52
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending