Javascript-Why do common js plug-ins use the name of a hyphen instead of a hump?

Source: Internet
Author: User
For common bootstrap, swiper, slide, fullpage, and so on, why is the "-" hyphen used instead of the camper? After all, you can double-click the camper to select it, and select another character. For common bootstrap, swiper, slide, fullpage, and so on, why is the "-" hyphen used instead of the camper?
After all, you can double-click the camper to select it, and select another character.

Reply content:

For common bootstrap, swiper, slide, fullpage, and so on, why is the "-" hyphen used instead of the camper?
After all, you can double-click the camper to select it, and select another character.

Front-end Code rarely uses the camper name method. The most common method is the hyphen. html and css code are the same. js uses the hyphen to unify the front-end code style.

You are talking about the class name and id name of css...

This general rule is consistent with the original language...

Css is always used-Connected, suchborder-color,margin-topAnd so on.

Html attributes are also used-Because html attributes are case-insensitive, using the hump will cause a lot of inconvenience, such ,

Js has always been using hump, suchgetAttribute,offsetHeight...
Js uses underscores, for example, defining the connection of constants.const GLOBAL_LOADDING = ''

However, many variables in js are underlined now...

Clearer semantics, clear at a glance

You can double-click to select an underscore.

Taking clarity and discerning at a glance as the primary objective

The selected style is not important.

Because the class name convention is to use-hyphens, you can look at the sass syntax, the default is to use.

The underline is clearer. At first, I also had a camper. Later, the company asked for the underline. Now I want to see the camper again. I feel like XX, especially I cannot know the meaning of the identifier immediately.

The underline is like an English word, which is easy to recognize and understand (the underline is regarded as a space, and the hump is connected and mixed)

In addition, you can double-click the underline to select it.

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.