Confirm the Ending (using javascript regex)

I’m trying to figure out why my code isnt wokring, can anyone help me figure out why? I’m trying to use the regular expression to get the end of the submitted string and then use an if statement to return true or false.

Your code so far

function confirmEnding(str, target) {
  let stringEnding = /str$/

 return  target = stringEnding ? true : false ;

confirmEnding("Bastian", "n");

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 11316.148.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.117 Safari/537.36.

Link to the challenge:

stringEnding should be a Boolean expression so you it can be evaluate as true or false (I dont see in your code what’s stringEnding is) .

Also I advice you to read about RegExp object it will help you to create a regex from the target argument