Credit Card Checker Algorithm

Hi there!

I’m working on the Credit Card Checker project https://www.codecademy.com/practice/projects/credit-card-checker and I’m lost…I’m not a native English speaker and I’ve been struggling with algorithms my whole life so this is a bit challenging for me.

I downloaded the solution and looked through it and still don’t understand some parts. For example,

function validateCred(numArr) {
if ((numArr.length - 1 - i) % 2 === 1) {
currValue *= 2;
}

The instruction and explaination is normally very clear to me but I have problem understanding this one - the Luhn Algorithm:
2. As you iterate to the left, every other digit is doubled (the check digit is not doubled). If
the number is greater than 9 after doubling, subtract 9 from its value.

So, it’s more like a language comprehension question. Could someone explain this for me in a simpler way? Thank you!

The project includes a visual outline:

https://codecademy-content.s3.amazonaws.com/PRO/independent-practice-projects/credit-card-checker/diagrams/cc+validator+diagram+1.svg

does that help?

also, you could take a valid and invalid credit card number and see if you can draw a good visual outline. Is a good challenge in helping you understand algorithms.