Skip to content

Instantly share code, notes, and snippets.

@jeffreyiacono
Created March 30, 2013 07:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jeffreyiacono/5275725 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="curry.js" />
<title>currying in javascript</title>
</head>
<body>
<div id="item">default</div>
</body>
</html>
(function() {
function request(some_param, callback) {
resp = {
responseText: some_param + " :: something from request"
};
callback(resp);
}
function update(id) {
return function(resp) {
document.getElementById(id).innerHTML = resp.responseText;
};
}
request("some param", update("item"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment