Skip to content

Instantly share code, notes, and snippets.

View VictorJoshuaC's full-sized avatar
🤖
Hackathon 🔥

Ryder VictorJoshuaC

🤖
Hackathon 🔥
View GitHub Profile
@VictorJoshuaC
VictorJoshuaC / Regex.js
Last active January 15, 2023 02:35
A simple JavaScript program that validates credit card numbers
// This program uses the test() method of the regular expression object
// to check if the card number matches the pattern of the respective card type.
// The program will check for a match against a regular expression for Visa, Mastercard,
// Verve and Discover card numbers in that order.
// If the card number is valid for a specific card type the respective
// message will be displayed and the checking will stop.