How does ~5 return -6?

I am asking this question as a follow up to my previous question. The page at W3chools says: The examples above uses 4 bits unsigned binary numbers. Because of this ~ 5 returns 10. Since JavaScript …