Skip to content

Instantly share code, notes, and snippets.

@danibrear
Created May 28, 2015 21:00
Show Gist options
  • Save danibrear/660cd8b9c84db32ff7aa to your computer and use it in GitHub Desktop.
Save danibrear/660cd8b9c84db32ff7aa to your computer and use it in GitHub Desktop.
Add a method to Array to zero all the elements.
Array.prototype.zeros = function() { return Array.apply(null, {length: this.length}).map(function(x){ return 0;}); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment