Possible Duplicate:
javascript bitwise operator question
Documentation says, that it is bitwise NOT
. But I don't understand these examples:
var a = ~1; a
-2
var a = ~8; a
-9
var a = ~-1; a
0
Possible Duplicate:
javascript bitwise operator question
Documentation says, that it is bitwise NOT
. But I don't understand these examples:
var a = ~1; a
-2
var a = ~8; a
-9
var a = ~-1; a
0