loading...

re: Daily Challenge #31 - Count IPv4 Addresses VIEW POST

FULL DISCUSSION
 

Here's mine! I extended it a little to work if the start and end were reversed.

const convertIPStringToNumber = ipString => ipString.split(".")
    .reduce((acc, part) => (acc << 8) | Number(part), 0);

const ipsBetween = (start, finish) => 
    Math.abs(convertIPStringToNumber(finish) - convertIPStringToNumber(start));

Gist: gist.github.com/kerrishotts/797450...

Code of Conduct Report abuse