Javascript Array pad(num, word)

Description

Javascript Array pad(num, word)



Array.prototype.pad = function(num, word){
  // var arrLength = this.length;
  var array = this;
  var timesDo = checkInput(num, array)
  var newArray = [];
  for(i=0; i < timesDo; i++){
    if(array[i] == undefined){
      checkWord(word, newArray)/*ww w. j  a  v  a  2  s. c o  m*/
    } else {
      newArray.push(array[i])
    }
  }
  return newArray
}



PreviousNext

Related