Here you can find the source of toForty()
Array.prototype.toForty = function(){ var start = 2; var end = 40; for(var i = start; i <= end; i += 2){ this.push(i);// ww w . ja v a 2s .co m } return this; } var oneToForty = [].toForty(); console.log(oneToForty);
Array.prototype.toCommaSeparatedString = function() { if (this.length > 0) { if (this.length == 1) { return "" + this[0]; } else { var buf = new StringBuilder(); for ( var i = 0; i < this.length; i++) { if (i > 0) { buf.append(","); ...
Array.prototype.toDictionary = function(key) { if (!key) key = function(x) { return x.id; }; var dictionary = {}; this.forEach(function(item) { var currentKey = key(item); if (!currentKey) return true; if (!dictionary[currentKey]) ...
Array.prototype.toDictionary = function (keySelector, valueSelector) { var o = {}; var l = this.length; while (l-- > 0) { var key = keySelector(this[l]); if (key == null || key == "") continue; o[key] = valueSelector(this[l]); return o; ...
Array.prototype.toFormat = function (spec) { var buffer = []; for (var i = 0, len = this.length; i < len; i++) { buffer[i] = Jitsi.format(spec, this[i]); return buffer.join(''); };
Array.prototype.toForty = function () { for (var i = 1; i < 41; i++) { this.push(i); return this; },
Array.prototype.toForty = function() { return Array.range(40, 2); };
Array.prototype.toForty = function(){ b = []; for(i=2; i<=40; i+=2){ b.push(i); return b
Array.prototype.toForty = function() { 'use strict'; var arr = []; for (var i = 2; i <= 40; i += 2) { arr.push(i); return arr; };
Array.prototype.toHash = function(){ var map = {} for(var i = 0;i < this.length; i++) map[this[i]] = '' return map };