JSFiddle - React, Tailwind, and code Playground
JavaScript
if (!Array.prototype.last){
Array.prototype.last = (function(){
return this[this.length - 1];
});
}
var arr = [1, 2, 3, 4, 5];
alert(arr.last());
if (!Array.prototype.last){
Array.prototype.last = (function(){
return this[this.length - 1];
});
}
var arr = [1, 2, 3, 4, 5];
alert(arr.last());