This article mainly introduces the concepts and usage of JS anonymous functions and anonymous self-executing functions. It analyzes the concepts, functions, application scenarios and related usage skills of anonymous functions and anonymous self-executing functions in the form of examples. Friends in need can refer to it. Next
The examples in this article describe the concepts and usage of JS anonymous functions and anonymous self-executing functions. Share it with everyone for your reference, the details are as follows:
1. Common scenarios of anonymous functions
The anonymous function in js is a very common function type, compare Common scenarios:
The above shows the common usage scenarios of anonymous functions. (Note: querySelector is a new method of finding DOM elements in H5)
2. Anonymous self-executing function
As the name suggests, anonymous self-executing function first It is an anonymous function, but this function can be executed automatically by itself without the help of other elements.