I have an integer that is less then 100 and is printed to an HTML page with JavaScript. How do I format the integer so that it is exactly two digits long? For example:
var result = [...Array(12)].map((_, i) => zeroFill(i + 1, 2));
function zeroFill(num, size) {
let s = num + '';
while (s.length < size) s = `0${s}`;
return s;
}
console.log(result)