Last active
November 6, 2018 20:12
-
-
Save ashleycoker/45cd461b41d4da5d9e6d73832e75c1b0 to your computer and use it in GitHub Desktop.
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
var f = function(){ | |
maxCount=5; | |
for (var i=0 ;i<maxCount; i++){ | |
alert(i); | |
} | |
} | |
function createOperations(){ | |
var operations = []; | |
for (var i = 0; i < 5; i++) { | |
operations.push(function(input){ | |
return input * i; | |
}) | |
} | |
return operations; | |
} | |
var ops = createOperations(); | |
for (var i = 0; i < 5; i++) { | |
alert(ops[i](i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment