All that’s great about CoffeeScript in 40 characters

Today, I needed a JavaScript equivalent of Ruby’s Array#compact (which returns the array stripped of any nil values). A standard JavaScript implementation looks like this: Array.prototype.compact = function() { var x, _i, _len, _results; _results = []; for (_i = 0, _len = this.length; _i < _len; _i++) { x = this[_i]; if (x != […]