Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of python's int('hex-string', 16) in Javascript? [duplicate]

Possible Duplicate:
How to convert decimal to hex in JavaScript?

Is there an equivalent of python's int('hex-string', 16) function in Javascript?

like image 919
leeand00 Avatar asked Oct 20 '25 08:10

leeand00


1 Answers

You can use parseInt():

var result = parseInt("0x42", 16);  // 66
like image 151
Frédéric Hamidi Avatar answered Oct 21 '25 20:10

Frédéric Hamidi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!