Skip to content

Instantly share code, notes, and snippets.

@jwheare
Created February 23, 2009 14:27
Show Gist options
  • Save jwheare/68965 to your computer and use it in GitHub Desktop.
Save jwheare/68965 to your computer and use it in GitHub Desktop.
Big fucking hack that you shouldn't use ever.
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