JavaScript efficiency tuning experience _ javascript skills

Source: Internet
Author: User
Sometimes you need to use the following knowledge when using multiple characters. 1. Put the definition of the number of cycles in the external body of the Loop: It seems that all languages are the same, and the effect on more than 100 elements is becoming more and more obvious. That is to say, for (var I = 0; I = 0; I --). After testing, I found that the efficiency is not much different from that of the ascending cycle.
2. Change the multi-layer object reference to a shorter path reference: In JavaScript, this problem is very obvious, such as the proposalNo domain var proposalNoField = fm. proposalNo. There is a huge difference between proposalNoField. value and fm. proposalNo. value in a loop (more than 100 times. Therefore, try to shorten the access path by using intermediate variables.
3. impact of third-party JavaScript packages: JavaScript supports prototypes, such as prototype. js modifies some of the behavior of the Array. Sometimes the code you write is okay, but if the prototype is modified, the problem also occurs, such as prototype. in js 1.4, there is a Bug. In some cases, array sorting will lead to an endless loop.

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.