次のコードcorrectSNILS
は最終的true
に Firefox (これは正しい) とfalse
IE7 にあります。理由を特定する方法は?
var value = "02324423703";
var correctSNILS = false;
if (value.length == 11) {
var controlDigits = value.slice(9);
var SNILS = value.slice(0, 9);
if (SNILS < 1001998) {
correctSNILS = true;
} else {
var total = SNILS.length;
var result = 0;
for (var i = 0; i < total; i++) {
result += (total - i) * SNILS[i];
}
if (result == 100 || result == 101) result = "00";
if (result > 101) result %= 101;
if (result == controlDigits) correctSNILS = true;
}
}
$("#result").text(correctSNILS);