Created
June 17, 2014 23:54
-
-
Save TravelingTechGuy/598123f5e45746b7d09e to your computer and use it in GitHub Desktop.
Fill array with same value/function
This file contains hidden or 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
var myFunc = function(x){return x*2;}; | |
var num = 3; | |
var array = Array.apply(null, Array(num)).map(function(){return myFunc;}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment