Skip to content

Instantly share code, notes, and snippets.

@naterkane
Created September 15, 2011 17:32
Show Gist options
  • Save naterkane/1219909 to your computer and use it in GitHub Desktop.
Save naterkane/1219909 to your computer and use it in GitHub Desktop.
function isCreditCard( cc ) {
var sum = 0, mul = 1, len = cc.length, _r = false;
if (l <= 18) {
for (n in cc) {
tproduct = n*mul;
sum += (tproduct >= 10) ? (tproduct % 10) : tproduct;
mul += (mul == 1) ? 1 : -1;
}
_r = ((sum % 10) == 0) ? true : _r;
}
return _r;
}
@getsetbro
Copy link

"l is not defined"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment