Take this IP address:
192.168.1.1
I want to break it down into 4 full binary octets, so:
11000000 . 10101000 . 00000001 . 00000001
.
All of the conversions I know, and those that I've found on other stackoverflow questions, only return the binary number itself, for example:
(1 >>> 0).toString(2)
returns 1
when I want 00000001
Number(2).toString(2)
returns 10
when I want 00000010
Is there an in-built javascript method that I haven't come across yet or do I need to manually add the 0's before depending on the number?