The conversion of JS and the _javascript technique of function

Source: Internet
Author: User

JS conversion into the system, divided into 2, 8, 10, 16 to the conversion between the system, we directly use the object. ToString () can be achieved by:

Run the following code

10 into 16
(in). ToString//=> "a"
//8 into 16
(012). ToString (a)//=> "a"
//16 into 10 system
(0x16). ToString (a)//=> "//16" into
8
(0x16). ToString (8)//=> "//10" to 2 into the system
//=>
(1111). ToString (2)//=> "10001010111"
//8 into the 2 system//=>
(01111). ToString (2)//=> "1001001001 "
//16 into the 2//=>
(0x16). toString (2)//=>" 10110 "

If you want to process 2 to 10, 16 to 10, 8 to 10, you need to use the Paresint method:

Run the following code

2 to 10
parseint (10,2)//=>2
//2 to 10; parseint
(100,2)//=>4//16
to 10
system parseint (a)//=>18//8 into
10
parseint (12,8);//=>10

In-process conversion

If you want to achieve the conversion between the system, you can use the Parseint method, first convert to 10, and then use ToString (parameter), into different systems;

Using the ToString and Parseint methods, you can implement a tool for transforming into a system:

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

Converts a string to Unicode, then converts Unicode to a different system, implementing Code Encryption Processing:

Run the following code

<! DOCTYPE html>
 
 

  0 wide characters

With a width of 0 wide characters, we convert all strings to binary and then use 0-wide characters to represent them, then the resulting string will be 0, and the main decompile can be restored.

Run the following code

 <!
DOCTYPE html> 

The above is a small set of JS in the introduction of the conversion and the role of all the narration, hope to help everyone, if you want to know more content, please pay attention to cloud Habitat community website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.