Credit Card Checker

Hi, could someone help me with this project, I got stuck on step 5, how to check if every element of batch starts with specific number. I thought to use loop and if to check if element and print if it’s correct, but it’s printing fault, that for loop not used correctly. Someone could help, please? And as well if could look through my whole code if it makes sense… thank you! :grimacing:

When you set const mValidateCred = validateCred; you’re actually setting the mValidateCred to [Function: validateCred]. Also, can you tell me on which lines (roughly) step 5 is?

Oh, sorry, step 5 starts on line 61.

Firstly, should you write batch.lenght or batch.length? (Check the spelling of length.) Also, what do you expect

if(for(let i=0; i<batch.length; i++))

to achieve? The if should be checking a condition. But what is the condition in this case?

I thought to loop through batch array to check which card stars with specific numbers, so I could name them. Because all cards starting number 3 I need to call Amex and etc. So I thought I need to loop to find it.

Yes, you need a loop to find it however, why do you have the if like you do:

if(for(let i=0; i<batch.length; i++))

What condition is the if statement meant to be checking? If you want to loop through an array, and check if each element meets a certain condition, how would you do that? Think about the order in which you want your logic to flow.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.