var testObj = this.getView();
How can I check with DoJo (or just native JS) if testObj has callableFunction
before I actually try to call callableFunction()
and fail if it isn't there? I would prefer a native-DoJo solution as I need this to work on all browsers.
You can call it like this:
testObj.callableFunction && testObj.callableFunction();
or in details:
if (typeof testObj.callableFunction == 'function') {
testObj.callableFunction();
}