In js there’s reduce. Something like
arr.reduce((result, currentValue, currentIndex, original) => {
if(currentIndex < original.length - 2
&& original[currentIndendex + 2] % 2 === 0 ) {
result.push(currentValue / 2)
} else {
result.push(currentValue);
}
return result;
}, [])
This would map arr and return halved values for elements for which the element two steps ahead is even. This should be available in languages where map is present. And sorry for possible typos, writing this on mobile.
As if microsoft ever tries to repro anything… Just refer them to some of the most clunkiest and convoluted sites ever, where it should say to just reboot three times and hope for the best.