+ 1
How to get the index of each td tag?
Im trying to get the index of each td tag when pressed... everytime I press a cell i get only 9 as the output instead of the index of that particular cell. I'm still new to JS. I would highly appreciate if someone could help me out! Here's the code: https://code.sololearn.com/Wd3qL8xU3J2t/?ref=app
2 ответов
+ 2
change var to let, its just quirky behavior of using var.
basicly every event using the very same i no matter if it changes or not
where as let in every itteration have a new i of that value
0
Thank you so much! It works!