Javascript String checkDNI()

Description

Javascript String checkDNI()

String.prototype.checkDNI = function() {
 var n = this.substr(0, this.length-1);
 var l = this.substr(this.length-1,1);
 n = n % 23;//w w w  . ja va 2  s . c o m
 var llist = 'TRWAGMYFPDXBNJZSQVHLCKET';
 var character = llist.substring(n, n + 1);
 if (character != l) {
  return false;
 } else {
  return true;
 }
};



PreviousNext

Related