JSFiddle - React, Tailwind, and code Playground
JavaScript
function toHex(str) {
var result = '';
for (var i=0; i<str.length; i++) {
result += str.charCodeAt(i).toString(16);
}
return result;
}
const result = `
"0123456789": ${toHex("0123456789")}\n
"π": ${toHex("π")}\n
"π€·π»ββοΈ": ${toHex("π€·π»ββοΈ")}
`;
alert(result);