Javascript Array run()

Description

Javascript Array run()


Array.prototype.run = function() {
    if (this.length == 0)
        return;//from  ww  w .  j  a va  2s .c om

    var newarg = this.slice(1);

    var rv = this[0]();
    if (rv && rv.done)
        rv.done(function() {newarg.run()});
  else
      newarg.run();
}



PreviousNext

Related