0

I made a array named "arr" length of 3 value and I also added addEventListener to 'formF' variable, when function of this addEventListener run it should 'push' formArr object to to "arr" array which is outside the event function but it doesn't. But if I console the 'arr' within the addEventListener function it shows that value is adding to arr array .And when I console it outside the addEventListener it doesn't add value to arr array. Could you solve this problem

I try spread operator and unshift function.

  • Logging it outside the event listener function means that log runs **before the function that mutates it has been called**! – Quentin Nov 08 '22 at 16:26
  • You should provide more information regarding your question, and you might post your code to show people where you are stuck. – Mithat Ercan Nov 08 '22 at 16:27

0 Answers0