Last active
August 29, 2015 14:23
-
-
Save kavitshah8/d3ef9263a58d1a7295cc to your computer and use it in GitHub Desktop.
Callbacks
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 coordinates(x, y, callback) { | |
callback(x, y); | |
} | |
coordinates(10, 20, function(x, y){ | |
console.log(x + y); | |
}); |
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
jQuery = { | |
get: function(url, params, callback) { | |
// DO XHR | |
if(response.status === 200) { | |
callback(response.data); | |
} | |
} | |
}; | |
jQuery.get('/get/food', 'token:pizzahut', function(data) { | |
return data; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment