JSFiddle - React, Tailwind, and code Playground
CSS
body {
font-family: sans-serif;
}
h1 {
font-size: 24px;
}
em {
color: red;
}
JavaScript
// Oh, fun!
const zero = '';
const one = '';
const zero_regex = new RegExp(zero, 'g');
const one_regex = new RegExp(one, 'g');
const html="";
const binToText = text => {
let str = text.replace(zero_regex, '0').replace(one_regex, '1');
if (str.match(/[10]{8}/g)) {
return str.match(/([10]{8}|\s+)/g).map(val => {
return String.fromCharCode(parseInt(val, 2));
}).join('');
}
}
// Inject HTML
document.body.innerHTML += binToText(html);