How to print the hex value of a character in JavaScript

1 Answer

0 votes
function get_bits(ch){
    return (ch.charCodeAt(0) >>> 0).toString(16);
}

var ch = 'a';
 
document.write(get_bits(ch));



/*
run:
   
61 
    
*/

 



answered Mar 6, 2019 by avibootz

Related questions

1 answer 84 views
1 answer 175 views
1 answer 161 views
1 answer 170 views
1 answer 128 views
2 answers 209 views
...