Javascript String repeat(frequency)

Description

Javascript String repeat(frequency)


String.prototype.repeat = function(frequency) {
  var repeatedString = []
  for (var i=0; i<frequency; i++) {
    repeatedString.push(this)/*w  ww .java 2 s. c o  m*/
  }
  return repeatedString.join('')
}



PreviousNext

Related