Having the following array of numbers
[0001, 0002, 0003]
I try to print them and keep the zeros, I thought that converting the numbers to string would solve the issue, but this is not the case, here are some options that I have tried
[0001, 0002, 0003].forEach(number => console.log(''+number)) // '1', '2', '3'
I get the same result if I try any of
- String(number)
- number.toString()
- number + ''
The result I expect is
// '0001', '0002', '0003'
Thanks in advance