Javascript String count(term)

Description

Javascript String count(term)




String.prototype.count = function(term) {
    return Array.prototype.filter.call(this, function (x) {
        return x == term;
    }).length;/*from w  w w  .ja  v  a  2 s .  co  m*/
}



PreviousNext

Related