Code example / luhn_check.js

Javascript luhn algoritm check example

Theis is an example of a small JavaScript function, luhn_check(), which checks whether a number is a valid based on the Luhn algoritm. One common example of use is with credit and debit card numbers. This function may be used to check for valid credit card numbers, however additional checks may be desired, such as card prefix and length checks.

Test number: 4111111111111111 (four followed by fifteen ones)