Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rjcorwin/6393619 to your computer and use it in GitHub Desktop.

Select an option

Save rjcorwin/6393619 to your computer and use it in GitHub Desktop.

working with hexadecimals in #javascript.md

back and forth

(parseInt(1373487419, 16)).toString(16)

convert hexadecimal to integer

var s = "1f"; alert(parseInt(s, 16)); // 31

var s = "0x1f"; alert(parseInt(s, 16)); // 31

var s = "xxxxx"; alert(parseInt(s, 16)); // NaN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment