How to convert hexadecimal to decimal numbers in JavaScript

2 Answers

0 votes
const hex = "A30C";

console.log(parseInt(hex, 16));

  
  
    
    
/*
run:
    
41740
    
*/

 



answered Jun 28, 2021 by avibootz
0 votes
const hex = "FD";
const dec = parseInt(hex, 16);
 
console.log(dec);
   
     
     
     
     
/*
run:
     
253
     
*/

 



answered Aug 25, 2021 by avibootz

Related questions

1 answer 167 views
1 answer 140 views
1 answer 136 views
1 answer 80 views
1 answer 83 views
...