Https://www.codecademy.com/practice/projects/credit-card-checker

Before I made the h function, it was correctly identifying which cards were valid and invalid.
Now the length of invalid cards array is 13.
let sum=0

// Add your functions below:

const validateCred=function(array){

for(let i=15; i>=0; i–){

if(i%2===0){

if(array[i]*2>9){

sum=sum+array[i]*2-9

}else{

sum=sum+array[i]*2

}

}else{

sum=sum+array[i]

}

}

if(sum%10===0){return’valid’

}else{

return’invalid’

}

}

const invalidCards=

const findInvalidCards=function(nested){

for(let j=0; j<nested.length; j++){if(validateCred(nested[j])===‘invalid’){

invalidCards.push(j)

}}

}

findInvalidCards(batch)

console.log(invalidCards)