you overwrite what duck is in the line above. Try to move the
duck.eat() to the line immediately after in which you do
duck = new Animal(...)
check what’s the value of duck at both those points, you are changing what duck is, so the second one doesn’t have a name property
It is best to provide actual code as well. We can’t run the code in the pictures.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.