For instance this code:
function stuff() { this.onlyMethod = function () { return something; } } // some error is thrown stuff().nonExistant();
You can also check if the method exists.
if(a['your_method_that_doesnt_exist']===undefined){ //method doesn't exist }