Skip to content

Instantly share code, notes, and snippets.

View pzurowski's full-sized avatar

Paweł Żurowski pzurowski

  • Warsaw (Poland)
View GitHub Profile
const weights = [7, 3, 1, 9, 7, 3, 1, 7, 3];
function isDocumentSerialNumberValid(input) {
return !weights
.map((weight, i) => weight * parseInt(input[i], 36))
.reduce((a, b) => (a + b) % 10, 0);
}