+ 2
JS_ Why does this code increment by 5 when I told it to do by 1
It's supposed to add a table cell when you click on the "+". Every time you click on it it should add a table cell. But it adds about 5 table cells at once. What's the problem? Sorry, I forgot to put the code https://code.sololearn.com/WaFZt9uKxWO1/#js
4 Antworten
+ 1
https://code.sololearn.com/WM5WmrdsR8WJ/?ref=app
+ 2
Jay Matthews it is in a loop, but I can't figure out why it's not working.
+ 1
Jay Matthews
I meant to put the code up with the question:
https://code.sololearn.com/WaFZt9uKxWO1/#js
0
Your for loop states that every time your loop is executed and th_names_count is less than 10 to increment it. And your next call is to increment again. So with that said you are incrementing it 2 times per loop. 10 ÷ 2 = 5