Credit Card Checker Project FOR loop doubles index 3 in array on the 5th loop through

For the credit card checker project the FOR loop doubles the number in index 3 and don’t understand why… the output is below of the reversed array and my code is below that.

link:

Please help me undersrtand why its doing that?

Output:

[ 5, 0, 9, 2, 8, 6, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]
[ 5, 0, 9, 2, 8, 6, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]
[ 5, 0, 9, 2, 8, 6, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]
[ 5, 0, 9, 2, 8, 6, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]
[ 5, 0, 9, 4, 8, 6, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]
[ 5, 0, 9, 4, 7, 6, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]
[ 5, 0, 9, 4, 7, 3, 0, 4, 3, 4, 4, 1, 1, 1, 0, 6 ]…
False

function validateCred(arr){
var sum = 0;
let reversedArr = arr.reverse();
for (let i = 0; i < reversedArr.length; i++) {
console.log(reversedArr);
if (reversedArr[i] % 2 === 0) {
reversedArr[i] *= 2;
if (reversedArr[i] > 9) {
reversedArr[i] -= 9;
}
}
sum += reversedArr[i];
}
return sum % 10 === 0;
}
console.log(validateCred(valid4));

I think you meant to change the element at that index in the array if the index is an even number,
but what you have changes the element if the element (the number in the array) is even.

So
reversedArr[i] % 2 === 0
should be
i % 2 === 0
or something like that.

it worked! thank you