I am attempting to iterate through a JavaScript table, aiming to display the elements located between two selections made by the user.
Here is an example of the table structure: if the user selects IDs 2 and 5, the loop should display rows 3 and 4. I tried using a for-loop but did not achieve the desired outcome.
var station = [
[0, 'JAMAA EL FNA', 'L1'],
[1, 'KOUTOUBIA', 'L1'],
[2, 'HOTEL DE VILLE', 'L1'],
[3, 'R.P BERDII', 'L1'],
[4, 'GRAND POSTE', 'L1'],
[5, 'CAREE EDEN', 'L1'],
[6, 'PL ABDELMOUMEN', 'L1'],
[7, 'PLACE D ARMES', 'L1'],
[8, 'FST', 'L1'],
[9, 'SEMIRAMIS', 'L1'],
[10, 'DR KUDIA', 'L1'],
[11, 'MCDO', 'L1'],
[12, 'CAFE AMINE', 'L1'],
[13, 'FAC SEMLALIA', 'L1'],
[14, 'ROUIDATE', 'L1'],
[15, 'CLUB MINISTRE JUSTICE', 'L1'],
[16, 'BEN TBIB', 'L1'],
[17, 'ASWAK SALAM', 'L1'],
[18, 'BAB DOUKALA', 'L1'],
[19, 'JAMAA EL FNA', 'L2'],
[20, 'KOUTOUBIA', 'L2']
];