How do you tell if a function in JavaScript is defined?
I want to do something like this
function something_cool(text, callback) {
alert(text);
if( callback != null ) callback();
}
But it gets me a
callback is not a function
error when callback is not defined.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…