57
rated 0 times
[
58]
[
1]
/ answers: 1 / hits: 67990
/ 13 Years ago, fri, july 22, 2011, 12:00:00
I have some functions which occasionally (not always) will receive a callback and run it. Is checking if the callback is defined/function a good style or is there a better way?
Example:
function save (callback){
.....do stuff......
if(typeof callback !== 'undefined'){
callback();
};
};
More From » coding-style