function asciiToHex(ch) {
// Get the ASCII value of the character
const asciiValue = ch.charCodeAt(0);
// Convert the ASCII value to a hexadecimal string
const hexValue = asciiValue.toString(16);
return hexValue;
}
const ch = 'z';
const hex_value = asciiToHex(ch);
console.log("The hexadecimal value of '" + ch + "' is 0x" + hex_value);
/*
run:
The hexadecimal value of 'z' is 0x7a
*/