function endsWith(str, suffix) {
        return str.indexOf(suffix, str.length - suffix.length) !== -1;
    }
Returns true if the given string ends with the given suffix.

@param {string} str
@param {string} suffix