Confirm the Ending | Am I allowed to use regex to solve this problem?

Tell us what’s happening:

It works anyway :joy:

  **Your code so far**

function confirmEnding(str, target) {
let myRegex = new RegExp(target + "$");
return myRegex.test(str);

confirmEnding("Bastian", "n");
  **Your browser information:**

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

Challenge: Confirm the Ending

Link to the challenge:

RegEx is a powerful tool, and as such and can be sometimes less performant than a no RegEx solution so as general rule of thumb I think it is a good idea to avoid using RegEx for things as simple as this

regex is a legit solution for this, yes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.