I tried to add event handler at line 166 and 167. I want the event handler executed with the parameter ``i```, whose value should be whatever when the handler was created.
Currently, if I trigger the event handler, edit(4)
is executed I guess the reason is the loop terminated with i = 4.
How can I trigger event handler edit(1), edit(2), edit(3), or edit(4) based on different buttons I clicked?
updated:
for (let i = 0;i < result["wishItems"].length; i++)
If I declare i
in for loop, it works.
However,
let i;
for (i = 0;i < result["wishItems"].length; i++)
this doesn't work.
Why does it matter where I declare i
?
Could anyone explain this?
Thank you!
Thank you!