Javascript String endsWithAny(terms)

Description

Javascript String endsWithAny(terms)


String.prototype.endsWithAny = function(terms) {
  return terms.reduce((result, term) => {
    let endsWithTerm = this.endsWith(term);
    return result || endsWithTerm;
  }, false);/*  www  .ja  v  a 2s .  com*/
};



PreviousNext

Related