Javascript String repeatify(numberOfRepeats)

Description

Javascript String repeatify(numberOfRepeats)


"use strict"//from   ww  w .  j  a  va 2  s .  c  o m

//Pipe method
String.prototype.repeatify = String.prototype.repeatify || function(numberOfRepeats) {
   var output = '';

    for (var i = 0; i < numberOfRepeats; i++) {
      output += this;
    }
    return output;
};

console.log("YES GIVE ME MORE ".repeatify(5));



PreviousNext

Related