Hello, I am not sure if anyone is stuck with this assignment. I am trying to do the ValidateCred part with the following code, but keep getting ‘false’ returned. If someone can give me some help, really appreciate it. Thank you!!

function validateCred(numArray) {

let total;

let currValue;

for (let i = numArray.length - 1; i >= 0; i–) {

if (i % 2 != 0) {

currValue = numArray[numArray.length - 1 - i] * 2;

if (currValue >= 10) {

currValue = currValue - 9;

}

}

else if (i % 2 === 0) {

currValue = numArray[numArray.length - 1 - i];

}

}

total += currValue;

if (total % 10 === 0) {

return true;

} else {

return false;

}

}

console.log(validateCred(valid1));