for (let firstIndex = length; firstIndex >= 1; firstIndex--) {
            sum += num.charAt(length - firstIndex) * pos--;
            if (pos < 2) {
                pos = 9;
            }