In Javascript when I do this
var num = 1; ~ num == -2
why does ~num not equal 0
in binary 1 is st
From the documentation:
Bitwise NOTing any number x yields -(x + 1). For example, ~5 yields -6.