Created
January 26, 2012 13:09
-
-
Save rmariuzzo/1682685 to your computer and use it in GitHub Desktop.
A simple JavaScript function to convert an hexadecimal value into its integer base-10 equivalent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert an hexadecimal value in a integer base-10. | |
* @param hex An hexadecimal value to convert. | |
* @return An integer base-10 equivalent to the given hexadecimal value. | |
*/ | |
function hex2int(hex) { | |
return parseInt(hex, 16); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment