I am coming from Python and I am looking for a single line iterator function for any array, where I can also check a condition and return a simple change to the items.
Expected result should match the method:
function arrayEvenItemIncrement(myArray){
for (let i = 0; i < myArray.length; i++){
if (myArray[i]%2==0){
myArray[i]++;
}
}
return myArray;
}
I tried using for (i of myArray){ } but this still doesn't serve my purpose.