I believe that every student who is new to JavaScript will be very confused about the function parameter passing. The reason is that its syntax is too weird. You define a function.
For example
function test(name,msg){ return 'hello' + name + msg; }
So how do you call it when calling? You can test('Eric'), test('Eric','welcome to javascript') or even pass it as many parameters as you like, and the types are arbitrary. What a great thing this is. Students who have studied c++/c# or java may think of function overloading. However, what I want to tell you is that there is no function overload in JavaScript. If you define two functions with the same name, the function defined first will be overwritten by the later definition, which means that the result you want can only be obtained from the later defined function.
Okay, let’s get back to the point. Why can JavaScript function pass so casually? Let’s first look at where all the passed parameters are stored. In fact, in its internal implementation, all the passed parameters are present in an array. The function always receives this array, and does not care about what parameters the array contains. Now it's easy to understand. We have defined a function. When calling, the parameters can be passed at will. It will be added to the array as much as you pass. If you don't pass it, then all your formal parameters are 'undefined'. There will be no syntax errors, but it is hard to say in terms of semantics.
OK, this is my first time writing a blog. I am not talented, so I am laughing at you. I hope this blog post can help you a little. . . .
I LOVE YOU,GUYS!