Javascript Array fromEnd(idx, t)
Array.prototype.fromEnd = function(idx, t) { if (t !== undefined) { this[this.length - (idx + 1)] = t; } else {// w w w .java2 s. com return this[this.length - (idx + 1)]; } }