Home >Web Front-end >JS Tutorial >A detailed explanation of JavaScript functions starts with the composition of the function_Basic knowledge
Javascript function is a rather strange thing. If you have been exposed to it for a while, you will be confused and unable to figure out what it is. Are you confused because some JavaScript functions have no names? Are you going crazy because the parameters of JavaScript functions have no types? Are you completely collapsed because JavaScript functions exist in the form of expressions? It is precisely because of these troubles that JavaScript functions are worthy of our consideration. I want to explain the function in detail from the composition of the function. This sounds like nonsense. Of course, when talking about anything, we should talk about it from the composition, but because of the JavaScript function, you do I can't figure out its shape, so here I will explain it in detail from the composition of a standard function.
1. Function name
In object-oriented languages, functions generally have names, but not necessarily for JavaScript functions. Such functions are called anonymous functions or function literals. It is like an expression, and then the lvalue of this expression can be used to call a function, or it can be stored in a variable and passed to other functions. Its advantage is that it does not need to create a new object every time it is called.