I'm given an array of integers such as:
const vals=[
00100,
11110,
00100101,
...
]
and I need to simply make each value iterable maintaining the position of the leading zeros. My first thought was to turn them into strings, but JavaScript wants to use base 10 and nothing that I have tried will change this. And when I try parsing it back to base 2, the leading zeros are all swapped around:
let testNum = 00100; // saves as 64
testNum = parseInt(testNum, 10); // using radix 2 returns NaN
testNum = testNum.toString(2); // 1000000
Any help would be greatly appreciated!