There might be some cases when we need to call a function without checking if function's definition is loaded or not. If loaded then that will be fine but if not loaded then it will throw an error as undefined function. We can handle this in Javascript:
if (typeof functionName == 'function') {
functionName();
}
In Jquery:
if ($.isFunction(functionName)) {
functionName();
}
0 Comment(s)