function updateSplitBlocks(num, selectors) { const numStr = numberPad(num, selectors.length, true) for (let index in numStr) { document.querySelector(selectors[index]).innerText = numStr[index].toString() } } function numberPad(num, length, abs = false) { if (isNaN(num)) { num = 0 } const negative = num < 0 && !abs const outStr = Math.abs(num).toString().padStart(length, '0') if (negative) { return '-' + outStr } return outStr }