Here you can find the source of first()
/*/*from w w w .j av a 2 s. co m*/ * Array Prototypes */ // Returns the first element of a given array 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 [];
Array.prototype.first = function () { this.current = 0; return jQuery.extend(true, [], this[this.current]); }; Array.prototype.last = function () { this.current = this.length - 1; return jQuery.extend(true, [], this[this.length - 1]); }; Array.prototype.next = function () { ...
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() { if (this.isEmpty()) { return null; return this[0]; };
Array.prototype.first = function() { if (this.length == 0) return null return this.slice(0)[0]