Javascript String endTrim(char)

Description

Javascript String endTrim(char)



String.prototype.endTrim = function (char) {
    let length = this.length;
    if (length) {
        if (this.charAt(length - 1) === char) {
            return this.substring(0, length - 1);
        }/*www. j  a va2  s .  c  o  m*/
    }
    return this.toString();
};



PreviousNext

Related