It seems to be saying that you are trying to read the properties of null.
Try to console.log the element you are trying to retrieve before trying to look at the style property.
In addition to what hbar1st is saying, I suggest that you should review hot to properly use a for loop to index through an array. That is another good reason to use the forEach method or at least for...of.
I would also suggest, that if possible, to get the list of nodes dynamically.
Hey, I have got a solution for you; The error in this code is that the loop should use "<" instead of "<=" in the for loop’s condition.
It should be for (i = 0; i < arrayLen; i++) {...}
This is because arrays are zero-indexed in JavaScript, so the last element in the array has an index of arrayLen - 1, not arrayLen.