I tried to search for Google and SOEN, but I did not find any reference to the ~
operator, I discovered that it exists, since I was reading a book about JavaScript and had an example using it, but the author also had not made any reference to the tilde before.
var i = 10;
var j = ~i; // j = -11
var l = ~-i; // l = 9
var x = ~true; // x = -2
var y = ~false;// y = -1
What is the function of the ~
operator and when is it usually used?