One-line JavaScript solution
javascript\n// One-line solution\nvar findComplement = function(num) {\n    return num ^ parseInt(\'1\'.repeat(num.toString(2).length), 2)\n};\n\n// Two-line so
```javascript\n// One-line solution\nvar findComplement = function(num) {\n    return num ^ parseInt(\'1\'.repeat(num.toString(2).length), 2)\n};\n\n// Two-line solution\nvar findComplement = function(num) {\n\tconst mask = \'1\'.repeat(num.toString(2).length)\n    return num ^ parseInt(mask, 2)\n};\n```\n\n
['JavaScript']