How to convert binary to hex in TypeScript

1 Answer

0 votes
let b = '11010';
let hex = parseInt(b, 2).toString(16).toUpperCase();
console.log(hex);
 
 
b = '1001101011';
hex = parseInt(b, 2).toString(16).toUpperCase();
console.log(hex);
 
 
    
   
   
/*
run:
    
"1A"
"26B"
    
*/

 



answered Dec 28, 2021 by avibootz

Related questions

1 answer 240 views
1 answer 361 views
1 answer 185 views
1 answer 172 views
...