-2
I’m trying to implement a function that can be in PHP or Js that takes the values of an array and displays them, only skipping indexes incrementally.
For example, I have the following array
numeros = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
Which should display the following numbers 0, 2, 5, 9, 14... As you can see, it starts by displaying the index value 0, skips an index of the current position and displays the value 2, skips two indexes of the current position and displays the value 5, and so on.
In this example the output should be the values 0, 2, 5, 9, 14, 20