JSFiddle - React, Tailwind, and code Playground

by Darby Rathbone

JavaScript

function asciitohex(s) {
    return (s.split('')).map(function (e) {
        return ''.substr.call("0" + e.charCodeAt(0).toString(16), -2)
    }).join('');
}
function hextoascii(s) {
    var _s = s,
        S = [];
    while (_s) {
        S.push(String.fromCharCode(parseInt(_s.split('').splice(0,2).join(''), 16)));
        _s = _s.split('').splice(2).join('');
    }
    return S.join('');
}
console.log(hextoascii(asciitohex('blackkbot\n')));