After completing the Credit Card Checker Project on CodeCademy, I decided to adapt it and try and display it on my site in a new page entry. This next project is another milestone in my JavaScript learning. As you can tell, I haven't devoted any extra learning to HTML/CSS since my Times Tables quiz (other than learning how to incorporate FontAwesome icons into HTML which is really neat). I will list out below all of the major learning points that have got me to this next step.
Click on the GitHub logo here to view my JS code in Github or see below in CodePen
This simple credit card number checker will validate the number you enter and return the credit card company that corresponds with the number. It does this by matching the first digit of the card number with the company. (For simplicity there are only 4 types of cards: Amex (starts with 3), Visa (starts with 4), MasterCard (starts with 5), Discover (starts with 6). The validating part of the code uses the Luhn Algorithm.
Here are some valid credit card numbers that DO NOT work but are drawn from the random generator on the FreeFormatter website If you copy and paste one of them in, they should return VALID
Please enter your credit card number below | |||
See the Pen Credit Card Checker by David (@e_mcsquared2) on CodePen.