How does this actually work? Both the post and MDN state that each bit in the 32 bit representation is inverted, resulting in:
5 => 00000000000000000000000000000101
~5 => 11111111111111111111111111111010
But parseInt("11111111111111111111111111111010", 2) is 4,294,967,290, not -6. (Even if the first bit were interpreted as the sign, shouldn't this be -2,147,483,642?)