javascript decode binary string code example
Example 1: string to binary javascript
// string to binary
parseInt(num.toString(2));
// binary to string
parseInt(num.toString(2), 2);
Example 2: string to binary javascript
let num = 2020;
let x = +num.toString(2);
console.log(x);