Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert hex to decimal using nodejs?

How do i convert hex values to their decimal value using nodejs ?

Suppose i have hex value as bellow

9c63e8e2f6574c197c0626bad843eb47104adf3f01f2901aad1258936feb007e

Any one have any idea the please let me know

like image 836
Codebrekers Avatar asked Jan 29 '23 10:01

Codebrekers


1 Answers

JS parseInt function takes base as a second argument. So you can simply use parseInt(hexString, 16).

For example: parseInt('ff', 16) will return 255.

like image 132
Valeria Viana Gusmao Avatar answered Feb 11 '23 05:02

Valeria Viana Gusmao