Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Parses credit card number with 16 characters into groups including 4 characters.
* Example usage: parseCreditCard('1234567890123456') -> [ '1234', '5678', '9012', '3456' ]
function parseCreditCard(cardNumber) {
return cardNumber.match(/.{1,4}/g);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.