Created
August 16, 2011 16:02
-
-
Save saturngod/1149428 to your computer and use it in GitHub Desktop.
node.js callback sample
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 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