javascript - calling function and ignoring callback parameter -
i want call this:
function fwc(a, b, callback) {  dosomestuff(a,b); callback(); }   with this:
fwc (a,b);   sometimes need callback , don't. can cause trouble when call function , ignore callback?
if can't change fwc function, can call :
fwc(a, b, function(){});   this way there won't error when fwc tries call third argument.
if can change it, change
function fwc(a, b, callback) {     dosomestuff(a,b);     if (callback) callback(); }      
Comments
Post a Comment