jQuery equivalent to Prototype array.last()
arrays, jquery
Solution
Why not just use simple javascript?
var array=[1,2,3,4];
var lastEl = array[array.length-1];
You can write it as a method too, if you like (assuming prototype has not been included on your page):
Array.prototype.last = function() {return this[this.length-1];}
Problem
Prototype: ``` var array = [1,2,3,4]; var lastEl = array.last(); ``` Anything similar to this in jQuery?