Javascript String forEach(func)

Description

Javascript String forEach(func)


String.prototype.forEach = function(func) {
  str = this.split("");
  for (var i = 0; i < str.length; i++) {
    func(str[i]);//w w  w  .j  a  va  2s. c  o  m
  }
};



PreviousNext

Related