I’ve been struggling getting over this problem I have with my code, for some reason every input arrays total sum adds up to 69 for some reason.

I.e:

const valid1 = [4, 5, 3, 9, 6, 7, 7, 9, 0, 8, 0, 1, 6, 8, 0, 8];

&

const invalid1 = [4, 5, 3, 2, 7, 7, 8, 7, 7, 1, 0, 9, 1, 7, 9, 5];

Would add up to 69 if all the odd numbers were multiplied by two and all numbers over 9 were subtracted by nine. I was wondering if anyone could see where I went wrong in my code:

```
const reducer = (accumulator, currentvalue) => accumulator + currentvalue;
let arr = valid1;
validateCred = (arr) => {
nDigit = arr.pop(0, -1);
arr = arr.slice(0, -1);
arr.reverse();
for (let i = 0; arr.length > i; i++){
digit = arr[i];
if (digit % 2 !== 0){
arr[i] = digit * 2;
}
if (arr[i] > 9){
arr[i] = arr[i] - 9;
}
}
sum = arr.reduce(reducer);
console.log(sum);
}
```