I have a system that takes input in the form of lines of text stored as an array, for example: array[123,556,"test",0,0]. By using val().split('\n'), I am able to add each new line to the array so that each line index is incremented by 1. Here's an example:
array[123,556,"test",0,1] = "line 1"
array[123,556,"test",0,2] = "line 2"
array[123,556,"test",0,3] = "line 3"
array[123,556,"test",0,4] = "line 4"
However, I need the last two indexes to display in reverse order. The arrays should look like this:
array[123,556,"test",1,0] = "line 1"
array[123,556,"test",2,0] = "line 2"
array[123,556,"test",3,0] = "line 3"
array[123,556,"test",4,0] = "line 4"
Somehow, they are able to increment the array index in the 4th position while I can only do it in the 5th position. I tried using .push(0) to add a 0 at the end but encountered errors.
Any suggestions or ideas on how to achieve this?
Thank you!