Created
March 29, 2015 16:39
-
-
Save theasta/dd1ee953d234e8bad9bb to your computer and use it in GitHub Desktop.
Decimal, Hexadecimal, Binary Conversion in JavaScript
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 from decimal to binary | |
(11).toString(2) // “1011" | |
// Convert from decimal to hexadecimal | |
(255).toString(16) // ‘ff' | |
// Convert from binary to decimal | |
parseInt("1011", 2); // 11 | |
// Convert from binary to hexadecimal | |
parseInt("ff", 16); // 255 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment