if (typeof sourceObj.someMethod === "function") { // you are safe using the method sourceObj.someMethod(); }