How do I convert, for example, the string "C3"
to its character using JavaScript? I've tried charCodeAt
, toString(16)
and everything, but it doesn't work.
var justtesting = "C3"; // There's an input here
var tohexformat = '\x' + justtesting; // Gives the wrong hexadecimal number
var finalstring = tohexformat.toString(16);