Created
February 23, 2009 14:27
-
-
Save jwheare/68965 to your computer and use it in GitHub Desktop.
Big fucking hack that you shouldn't use ever.
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
function list (vars, context) { | |
if (typeof(context) === 'undefined') { | |
context = window; | |
} | |
return function (item, i) { | |
context[vars[i]] = item; | |
}; | |
} | |
[1,2,3].each(list(['foo','bar','baz'])) | |
// foo = 1 | |
// bar = 2 | |
// baz = 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment