JS's binary conversion, divided into 2 binary, 8 binary, 10 binary, 16 binary between the mutual conversion, we directly use the object. ToString () can be implemented:
Run the following code
10 binary to 16 binary. ToString (+)//= "A"//8 into 16 binary (012). ToString (+)//= "A"//16 into 10 binary (0x16). ToString (10)/ /= "22"//16 into 8 binary (0x16). ToString (8)//= "26"//10 into 2//=> (1111). ToString (2)//= "10001010111"// 8 binary to 2 binary//=> (01111). ToString (2)//=> "1001001001"//16 into 2//=> (0x16). ToString (2)//= "10110"
If you want to handle 2 binary to 10, 16 to 10, 8 to 10, you need to use the Paresint method:
Run the following code
2 binary to 10 binary, parseint (10,2)//=>2//2 to 10, parseint (100,2)//=>4//16 to 10 binary parseint (+)//=>18// 8 binary to 10 binary parseint (12,8); =>10
Binary conversion
If you want to achieve the conversion between the system, you can use the Parseint method, first converted to 10, and then the use of ToString (parameters), transformed into different systems;
The ToString and Parseint methods enable you to implement a binary conversion tool:
Run the following code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> Simple encryption decryption
Convert the string to Unicode, and then convert the Unicode to a different binary, implementing Code encryption Processing:
Run the following code
<! DOCTYPE html>
0 wide characters
Using the 0 width of the 0 wide character, we convert all the strings into binary, then use the 0 wide character to represent, then the resulting string length will be 0, the main anti-compilation can be restored,
Run the following code
<! DOCTYPE html>
JS binary conversion