[] () +! How JavaScript code works

Source: Internet
Author: User

I posted this blog post yesterday and introduced this special JavaScript implementation method. Many people leave a message saying they don't understand it. I will give you a brief analysis. In fact, it uses the simple principle of JavaScript.

First, let's analyze what these characters are:

! = False

[] = Array

+ = Connector

() = Object Separator

 

Then how to implement various JavascriptCodeWhat about it? For example, how do we create a role?

Very simple :(! [] + []) [1]. See it. That is, equivalent to "false" [1], the second character of the false string.

 

Then someone asked me how to input 1? No 1 in false?

First, we need to know how to represent true, and how to represent true if false is used?

Simpler :! + [].

Then you will understand that true = 1.

That .. How do I express it ?... Of course it is true + true, that is! + [] +! + []

 

Some people asked, What should I do if some characters are not true or false?

You can refer to the code table described in the previous article for a one-to-one correspondence.

 

In fact, this mainly utilizes the flexible expressions in Javascript, which have high requirements on basic skills. You need to understand the values of various types of characters under various types of conversions, and then splice them together.

 

This technology .. It feels like a Trojan... I can't think of any other functions.

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.