5 lines = 0,1,2,3,4 so i<numLines will see you ...
# suitescript
n
5 lines = 0,1,2,3,4 so i<numLines will see you good from 0 - 4 which is correct you add 1 to numLines and you're looking at index[5] of the list which doesn't exist