3 ms·
Array.prototype.compact = function( list) { for ( var i = list.length; i >= 0; i--) { if ( list[ i ] == null) results.splice( i, 1); }
by elliotbradly 12y ago
Array.prototype.compact = function( list) {
for ( var i = list.length; i >= 0; i--) {
if ( list[ i ] == null) results.splice( i, 1);
}
- gmac 12y agoThat is nice, but you'd need to first copy this (or 'list') to results to make it do the same as the CoffeeScript example.