Created
August 23, 2010 15:14
-
-
Save radamant/545684 to your computer and use it in GitHub Desktop.
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 numbers = [1,2,3,4]; | |
| var numObject = { | |
| 1: 1, | |
| 2: 2, | |
| 3: 3, | |
| 4: 4 | |
| } | |
| var funcs = []; | |
| funcs.push(function(){console.log("from array")}) | |
| $(numbers).each(function(i, item){ | |
| var number = item; | |
| funcs.push(function(){ | |
| console.log(number * number); | |
| }); | |
| }); | |
| funcs.push(function(){console.log("from object")}) | |
| for(index in numObject){ | |
| var number = numObject[index]; | |
| funcs.push(function(){ | |
| console.log(number * number); | |
| }); | |
| } | |
| $(funcs).each(function(i, item){ | |
| item(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment