List of utility methods to do Array Last
last(predicate, def)Array.prototype.last = function (predicate, def) { var l = this.length; if (!predicate) return l ? this[l - 1] : def == null ? null : def; while (l-- > 0){ if (predicate(this[l], l, this)) return this[l]; return def == null ? null : def; }; ... | |
last(t)Array.prototype.last = function(t) { if (t !== undefined) { this[this.length - 1] = t; } else { return this[this.length - 1]; | |
last(value)Array.prototype.last = function(value) { if (this.length) { var last = this[this.length-1]; if (value != undefined) return (value == last) ? true : false; else return last; return ''; ... | |
last(value)Array.prototype.last = function(value) { if (this.length) { var last = this[this.length-1]; if (value != undefined) return (value == last) ? true : false; else return last; return ''; ... | |
last100()Array.prototype.last100 = function () { if (this.length < 100) return this; var last100 = []; var start = this.length-101; for (var i = 0; i < 100; i++) last100.push(this[i + start]); return last100; |