Javascript Array assign(val)

Description

Javascript Array assign(val)


// Some usefull extensions for array

/// Assign value to all values of the array
Array.prototype.assign = function(val) {
 for (var i = 0, len = this.length; i < len; ++i) {
  this[i] = val;/*  w w w.  jav  a  2 s  . c o  m*/
 }
}



PreviousNext

Related