Javacript advanced Programming-best practices

Source: Internet
Author: User
1. Best Practices

Code conventions from other languages can be used to decide when to comment and how to indent, but JavaScript needs to create special conventions for its loosely typed nature

L JavaScript should define behavior, HTML should define content, CSS should define appearance

The confusion in these responsibilities can lead to errors and maintenance problems that are difficult to debug

• The events that JavaScript takes to execute directly affect the performance of the Web page

L DOM Interaction is expensive and requires limiting the number of DOM operations

L can consider merging JavaScript files into a single file

L Use the compressor to make the file as small as possible

Use with HTTP compression to make JavaScript files as small as possible, with minimal impact on overall page performance

Javacript advanced Programming-best practices

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.