JavaScript 1 line
\nvar findComplement = function(num) {\n   return num ^ parseInt(num.toString(2).replace(/\\d/g, '1'), 2);\n};\n
```\nvar findComplement = function(num) {\n   return num ^ parseInt(num.toString(2).replace(/\\d/g, '1'), 2);\n};\n```
['JavaScript']