Here you can find the source of first()
Array.prototype.first = function() { if (this[0] !== undefined) return this[0] else {// w w w . j a v a2 s. co m throw new TypeError("Can't get first element of an empty array.") } }
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; };
"use strict"; Array.prototype.first = function () { if (this.length === 0) { throw "Empty string doesn't have first element"; return this[0]; }; console.log(["a", "b", 3].first());
Array.prototype.first = function () { return this[0]; };
var dict = { path: 24, montes:23, mike: 37, andrea: 21} var friends = [] for (var name in dict) { friends.push(name + ":" + dict[name]) console.log(friends) var dictAux = {} dictAux.alice = 34 dictAux.bob = 4 ...
Array.prototype.first = function(){ if (this.length > 0) return this[0]; else return [];