My array consists of 3 groups, with each group containing 5 elements.
var tempArray1 = ['prodn', 'PP1', 'UK1', 'Exp', 'India2', 'prodn', 'PP2', 'france1', 'Imp', 'Czech2', 'prodn', 'PP3', 'Germ1', 'Exp', 'Rom2']
I am looking to remove the 2nd element in my array and then delete every 5th element, which will eliminate all elements starting with "PP". It is important for me to remove these elements based on their position in the array, not by character type. The following code demonstrates how I plan to remove every 5th element:
var indexToRemove = 5; // start position
var numberToRemove = 1; // elements to remove
tempArray1.splice(indexToRemove, numberToRemove);
However, I am unsure of how to initiate this process from the 2nd element. Any guidance would be appreciated. Thank you.