2618. Check if Object Instance of Class¶ TypeScript 1 2 3 4 5 6 7 8 9function checkIfInstanceOf(obj: any, classFunction: any): boolean { while (obj != null) { if (obj.constructor === classFunction) { return true; } obj = Object.getPrototypeOf(obj); } return false; }