Using instanceof and class.isInstance