JS why everythingis changing in the array?
Hello,
When I add (Hozzáadás button) object to my array with push,
and after I add another object,
why everythingis changing in the array?
How should I have to add correctly?
https://codepen.io/lanszelot/pen/eYarmbN?editors=1011
Please fill all 3 because I deleted "empty check" for shortening the code. Easier to read.
2 Replies
if you make it a form, you can take advantage of the
new FormData()
constructor
that makes it easier to collect all the fields and values.
Hello,
Thank you for your response.
Form not good. It is more complicated.
That way how I did it I should have to solve. But I don't know what is wrong.
Hello, I solved. The problem was I .push a variable in the array, not datas. So when the variable changes inside the array changes too. Because in the array was : [variable, variable] not datas.
I had to add datas.