Given the entity Dog, Cat, Woodpecker, who are the heirs of the essence of Animal. Animal contains the properties age, name, sound, region and the say method. Dog, Cat, Woodpecker does not explicitly contain these properties, but inherits them from Animal. They also contain a goAway method.
Implement the getTypep () function, which takes one of the objects Dog, Cat, Woodpecker and returns its type without using the instanceof operator, but by checking for the presence of properties / methods of the objects.
There are 2 possible solutions, it is to check the constructor object, for example, cat.constructor === Cat, or for Animal to override the toString method, which will return the name of the constructor. But it seems to me that this is not what is requested in the condition.
Functionanameproperty added, soobj.constructor.namewill beobj.constructor.name. But the task is too non-specific, was any code attached to it? - Grundy