Here you can find the source of first()
Array.prototype.first = function() { return this[0]; };
Array.prototype.first=function(){ return this[0] Array.prototype.last=function(){ return this[this.length-1]
Array.prototype.first = function() { return this[0]; Array.prototype.last = function() { return this.reverse()[0];
Array.prototype.first = function(){ if(this.length > 0) return this[0]; return null; };
Array.prototype.first = function() { if (this[0] !== undefined) return this[0] else { throw new TypeError("Can't get first element of an empty array.")