Javascript Number times(doThis)

Description

Javascript Number times(doThis)


// Ruby-esque "times" method
// CONTAINS BUG/*from   w ww .j  a va2s . c o m*/
Number.prototype.times = function(doThis) {
  val = +this;
  while (val > 0 ) {
    doThis();
    val--;
  }
}



PreviousNext

Related