Hiya,

I’m working on the credit card checker project, and am stuck applying the luhn algorithm. I’ve successfully popped, and reversed the original string - and found the odd numbers, and multiplied them by 2. Now, I’m trying to take the numbers over 9 and subtract 9 while keeping them in the same string with the other numbers.

I’m not sure if this is the right direction to take - but I’ve been going around in circles for hours and need a nudge in the right direction.

Any help or thoughts would really be appreciated. Thank you!

**My code is below:**

function validateCred(array){

*// remove last integer*

array.pop();

*//reverse the array*

array.reverse();

*//make new array with only odd index elements*

const oddArray = ;

for(let i= 0; i < array.length; i++) {

if (i % 2 === 0) {

oddArray.push(array[i]);

}

}

*//take all results and multiply them by 2*

var multiplyResult = oddArray.map(i => i*2)

*//TROUBLE SPOT*

let calcResult = multiplyResult.map(i =>

{if (i>9) {

i=i-9

} else {

i=i

}

});

return calcResult

};

*//used to check results in terminal*

console.log(validateCred(valid1));