For Loop Not Displaying The Correct Content
I had a problem displaying the correct content while using the for loop. A big shout out @Alireza Ahmadi for resolving my problem. I would still like to understand where my logic w
Solution 1:
This happens because you are in loop. Yes animalsClass[0]
had the content of dog
But you are in loop and then you go for animalsClass[1]
!
Note that you need to check that tag you put on mouse, that is helper.origin
.
animalsClass
has dog
and whale
value and you check both of them in loop and both of them meet your condition if(animal.animals.hasOwnProperty(animalsClass[i].textContent))
.
Post a Comment for "For Loop Not Displaying The Correct Content"