function isIdCard(arrIdCard) {
var tag = false;
var sigma = 0;
var a = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var w = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
for (var i = 0; i < 17; i++) {
var ai = parseInt(arrIdCard.substring(i, i + 1));
var wi = a[i];
sigma += ai * wi;
}
var number = sigma % 11;
var check_number = w[number];
console.log(arrIdCard.substring(17) ,check_number );
if (arrIdCard.substring(17) != check_number) {
tag = false;
} else {
tag = true;
}
return tag;
}
let ster = '450121198401200335';
console.log(isIdCard(ster));
console