code is just 20 lines and when starting it gives an error about the shortage of memory, I have not previously observed this 4GB of RAM, I apply a photo. And there is one more question if someone understood the code, you can explain how the first function (function) may be related to Var Years? I did not understand this moment, the video explains this but unfortunately I did not fully understand it. Thanks
Answer 1
Do you have an error in the code
for (var i = 0; 1 & lt; arr.length; i ++)
Change please the termination condition correctly
for (var i = 0; i & lt; arr.length; i ++)
Otherwise there is an infinite cycle with a constant addition to an array of the
element
On the second issue, your function is not related to this array, only by passing an array in the parameter you can link them ideally, and your array is declared globally and essentially visible for all your functions.