Here you can find the source of toArray()
// refactored//from w w w .j av a 2s . co m Array.prototype.toArray = function() { return [].concat(this); };
Array.prototype.toArray = function() { var results = new Array(this.length); for (var i = 0, len = this.length; i < len; i++) { results[i] = this[i]; return results; };
Array.prototype.toArray = function() { return this.clone(); };
Array.toArray = function(obj, start) { return Array.prototype.slice.call(obj, start); };
Array.prototype.toArrayInt = function () { for (var i=0; i<this.length;i++) { this[i] = parseInt(this[i]); return this; };
Array.prototype.toColor = function() { var n = this.length <= 3 ? 3 : 4; var pieces = this.concat( [0,0,0,0] ).slice(0,n); if (!this.length) { return "rgb(" + pieces.join() + ")"; } else if (this.length <= 3) { return "rgb(" + pieces.join() + ")"; } else if (this.length >= 4) { return "rgba(" + pieces.join() + ")"; ...