Check if a string ends with the given target string
- String.prototype.substring() method: returns a subset of a string between one index and another, or through the end of the string.
Since if indexEnd is omitted, substring() extracts characters to the end of the string.
Therefore, in this syntax, it returns between (str.length: 16 — target.length: 9) str and end of str. //
str = “westernaustralia”
str.substring(str) is equal to target string which is “australia”, so it returns