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.
callableFunction
callableFunction()
You can call it like this:
testObj.callableFunction && testObj.callableFunction();
or in details:
if (typeof testObj.callableFunction == 'function') { testObj.callableFunction(); }
2.1m questions
2.1m answers
60 comments
56.8k users