How to use Bitwise NOT operator in Javascript
Description
The bitwise NOT is represented by a tilde (~
) and returns the one's complement of the
number.
Example
var num1 = 25; //binary 00000000000000000000000000011001
var num2 = ~num1; //binary 11111111111111111111111111100110
console.log(num2); //-26
The code above generates the following result.