Here you can find the source of compacted()
////from w w w .j av a 2 s . c o m // Array extensions // Array.prototype.compacted = function () { var tmp = []; for (var i = 0; i < this.length; i++) { if (this[i] !== undefined && this[i] !== null && this[i] !== false) { tmp.push(this[i]); } } return tmp; };
Array.prototype.compact = function() { return this.filter(function (i) { return !!i; }); };
Array.prototype.compact = function() { var comp = []; for (var i = 0;i < this.length; i++) { if (this[i]) { comp.push(this[i]); return comp;
Array.prototype.compact = function(deleteValue) { for (var i = 0; i < this.length; i++) { if (this[i] == deleteValue) { this.splice(i, 1); i--; return this; }; ...
Array.prototype.compact = function(fn) { for (var i = 0; i < this.length; i++) if (this[i] == null) { this.splice(i, 1); return this;
Array.prototype.compacted = function () { var tmp = []; for (var i = 0; i < this.length; i++) { if (this[i] !== undefined && this[i] !== null && this[i] !== false) { tmp.push(this[i]); return tmp; }; ...