{} and function () {} to use empty object {} to store Keyvalue_javascript tips

Source: Internet
Author: User
Tags key case
Try must lose, wrote a use of the Operation URL JS Tool class, this class has a property called QueryString, my original approach is to let Querystring=function () {},

The idea is to want to be able to querystring[key] or querystring (Key[,value]), which is supported by both ways, calling key case sensitive through Querystring[key

With QueryString (key), it can be case independent.

Today's cup with the discovery URL with the name parameter is not set up anyway, suddenly remembered QueryString is an anonymous function, name,length and other attributes are read-only,

Or the ground obediently changed into querystring = {}; Use a different param (Key[,value]) to implement case-insensitive functionality.

Today's conclusion is that the field used to put KeyValue is best not to use function () {} so that there is already a type of built-in property to store the keyvalue.

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.