how to convert text to binary in javascript 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);