Skip to content

Instantly share code, notes, and snippets.

@saturngod
Created August 16, 2011 16:02
Show Gist options
  • Save saturngod/1149428 to your computer and use it in GitHub Desktop.
Save saturngod/1149428 to your computer and use it in GitHub Desktop.
node.js callback sample
function division(num1,num2,callback) {
if(num2 <=0 ) {
callback("num2 shouldn't be less than or equal zero");
}
callback (null,num1/num2);
}
division(5,4,function(err,result) {
if(err==null) {
console.log(result);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment