Created
January 5, 2023 15:52
-
-
Save gioiliop7/aae5a33da9e7b9b18c67034e22be0c8d to your computer and use it in GitHub Desktop.
[JS] Validate Greek Vat Num
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function checkAFM(afm) { | |
| afm = afm.split("").reverse().join(""); | |
| let Num1 = 0; | |
| for (var iDigit = 1; iDigit <= 8; iDigit++) { | |
| Num1 += afm.charAt(iDigit) << iDigit; | |
| } | |
| return (Num1 % 11) % 10 == afm.charAt(0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment