title: Inverting a binary value of a number
body: <p>I would like first to convert a number to binary, then invert it bitwise.
  Like this:</p>
  <p>Number is 793 = <code>1100011001</code>
  then convert the binary value into: <code>0011100110</code></p>
  <p>In JavaScript I can do the following:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var x = 793;
  document.write(x.toString(2)); // gives 0011100110</code></pre>
  </div>
  </div>
  </p>
  <p>This will give me the binary value of the number.
  But how do I invert the binary bitwise?</p>
  <p>I tried the <code>~</code> operator, but not working probably. The output is: <code>-1100011010</code></p>