Skip to content

Instantly share code, notes, and snippets.

@rmariuzzo
Created January 26, 2012 13:09
Show Gist options
  • Save rmariuzzo/1682685 to your computer and use it in GitHub Desktop.
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.
/**
* 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