Created
May 28, 2015 21:00
-
-
Save danibrear/660cd8b9c84db32ff7aa to your computer and use it in GitHub Desktop.
Add a method to Array to zero all the elements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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