How to check if an object has a function? (DoJo)

You can call it like this:

testObj.callableFunction && testObj.callableFunction();

or in details:

if (typeof testObj.callableFunction == 'function') {
    testObj.callableFunction();
}

Leave a Comment