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 246 views
1 answer 366 views
1 answer 191 views
1 answer 178 views
...