Credit Card Checker Challenge Project (JavaScript)

This is my solution, with all the challenges solved too.
I named the function converting the string to credit card number stringToNum. The function to make an invalid credit card valid is called makeValid.

Hello all,

I finished the project and gave it a few extra.

  1. The function that converts to change strings to arrays is implemented is implemented in the validateCred function. Therefore it has become a check for correct input.

  2. the makeNumberValid function displays the both the old ‘false number’ and the new valid number.

If you run this the console gives you a pretty good overview of whats happening. Any tips for improvement welcome.

by creating an array of the numbers corresponding with the know credit card companies and comparing those to the first digits of the cc number, no duplicate company names where entered in the result array. This seemed to overrule the need for an indexOf method as shown in the solution. Just two different approaches i guess :slight_smile:

Any improvements let me know!

Hi there ! Here you’ll find my version for this lesson. Absolutely not the better way to program, but it runs.