Skip to content

Instantly share code, notes, and snippets.

@micmath
Created June 11, 2010 10:54
Show Gist options
  • Save micmath/434354 to your computer and use it in GitHub Desktop.
Save micmath/434354 to your computer and use it in GitHub Desktop.
function f(key, val) {
return function(k) {
if (k === key) { return val; }
else return undefined;
};
};
var o = f(1, 2);
// what value does each alert?
alert(o(1));
alert(o(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment