JSON property name why double quotes (personal guessing) _javascript tips

Source: Internet
Author: User

Reason one:

More standardized, conducive to interpretation

Reason two:

Avoid incompatible problems with keywords such as class

Reason three:

Perhaps the most obscure:

var a = 00; var B = {00:12}; A in B; --> true
var a = 0; var b = {' A ': A in B;--> false

Personal guess if the property name of a JS object is not a string, the type conversion is first, but the unexpected value may occur in the process, although it is only an example, but it is necessary to develop a good habit.

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.