Optimization

Posted May 27, 20201 min read

Performance optimization is one of the necessary skills for front-end development. Of course, we must pay attention to and master it.

  1. Anti-shake:A large amount of the same event is triggered in a short time, and the function will only be executed once. Related to setTimeout function.

  2. Throttling:The same event is triggered in a large amount in a short period of time. After the function is executed once, the function will no longer work within the specified time until it takes effect again after this time.