How to convert from Hex
string to ASCII
string in JavaScript?
Ex:
32343630 it will be 2460
function hex2a(hexx) { var hex = hexx.toString();//force conversion var str = ''; for (var i = 0; i < hex.length; i += 2) str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); return str; } hex2a('32343630'); // returns '2460'
Another way to do it (if you use Node.js):
var input = '32343630'; const output = Buffer.from(input, 'hex'); log(input + " -> " + output); // Result: 32343630 -> 2460
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With