- A considerable number of host interactions
- Poor event handling
- Jumbled code
- Inefficient loops
3) Eliminate the problem of memory leaks
4) Avoid unwanted iterations by breaking the loops as soon as possible
No matter how large or small the cycle of a loop, it always consumes a significant amount of time to load. So, it is recommended for you to break the large loops as soon as possible. It can be achieved by using the two keywords like break and continue. For instance, you would not use the break keyword; then, this loop will run 10000 times.
5) Reduce DOM interactions
Try to access the DOM only once and use it as a local variable. You can remove the value by setting it to null. As a result, the garbage collection process will occur, and it will eliminate the problem of memory leaks.
6) Use HTTP/2 Protocol
You can check the difference in these two protocols by visiting this website: HTTP vs HTTPS
7) Prevent thread blocking with the use of Asynchronous code
Use the Async tag so that browser loads the script without affecting the rendering process. However, the Defer tag can be used when you want to tell the browser to load the script after the rendering process finished.
10) Order is necessary for the element loading
In a few words