Skip to content

Instantly share code, notes, and snippets.

View onovogodwinprosperity's full-sized avatar
💭
Putting my best practice with y time and always learning new things for advance

Onovo Godwin Prosperity onovogodwinprosperity

💭
Putting my best practice with y time and always learning new things for advance
View GitHub Profile
@onovogodwinprosperity
onovogodwinprosperity / ValidationTask.js
Created January 14, 2023 20:45
Validation of Payment card (Visa and Master Card) Using Regular Expression
// below are the indept explanation of some of the signs i use:-
// (/) sign inside bracket alert the js engine that am about to declare a regular expression
// (^) is telling the JS engine again that what i need as the first digit is (5 if its master card, 4 if its Visa card as i declare it differently )
// ($) This sign tells the JS engine that am done with the parttern i want to use and validate any kind of input i need in my application
//============================================================== ======================================================
// MASTER CARD VALIDATION
// Its known very well that every payment cards has there specifi numbers of digits
// Master Card has a Total 16 digits
// Valid Master card digits always start with five (5) digit