Mod 10 Algorithm

Published by BijogFc24 in

Create a function that takes a number and checks whethers the given number is a valid credit card number using Luhn Algorithm. The return value is boolean.

Examples

validCreditCard(4111111111111111) ➞ true
// Visa Card

validCreditCard(6451623895684318) ➞ false
// Not a valid credit card number.

validCreditCard(6451623895684318) ➞ false

Notes

  • American Express/VISA/Discover/Diner Club may be the credit card type.
  • Check the Resources for help.
Watch a quick demo on how Edabit works.