Last active
September 7, 2020 02:51
-
-
Save kiinlam/419b5d31d973dd7ce85595c00adff69b to your computer and use it in GitHub Desktop.
[js进制转换]
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
// toString(radix) | |
// 任意数值转为指定进制 | |
0x6600.toString(2) // "110011000000000" | |
// parseInt(value, radix) | |
// 将value作为指定进制radix来解析,得到10进制结果 | |
parseInt("110011000000000",2) // 26112 | |
// 任意进制相互转换 | |
// 先转10进制,再换成目标进制 | |
parseInt('ff',16).toString(2) // "11111111" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment