Challenge: Confirm the Ending

Someone who could shed some light on why this piece of code is not working?

function confirmEnding(str, target) {
let ending = /\w$/;
return str.match(ending) === target ? true : false;
}

console.log(confirmEnding("Bastian", "n"));

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

Challenge: Confirm the Ending

Link to the challenge:

match returns an array

target can be of any length

1 Like