Skip to content

Instantly share code, notes, and snippets.

@amaltson
Created June 1, 2011 01:44
Show Gist options
  • Save amaltson/1001639 to your computer and use it in GitHub Desktop.
Save amaltson/1001639 to your computer and use it in GitHub Desktop.
Trying to figure out async in node
function testWithCallback(callback) {
var result;
for (var i = 0; i < 1000000000000; i++ ) {
result += i;
}
callback(result);
}
testWithCallback(function(result) {
console.log(result);
});
console.log('This should happen right away');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment