Confirm the Ending

Check if a string (first argument, str) ends with the given target string (second argument, target).

My approach is using string.substring() method. First, I played around with .substring() method in console.