programming-examples/js/String/Convert Hexadecimal to ASCII format.js
2019-11-15 12:59:38 +01:00

11 lines
321 B
JavaScript

function hex_to_ascii(str1)
{
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {
str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
}
return str;
}
console.log(hex_to_ascii('3132'));
console.log(hex_to_ascii('313030'));