Believe that every one of the students just contact JavaScript in the function of the parameters of the transfer will be very confused, the reason for him, that is its syntax is too weird, you define a function
For example
function test (name,msg) {return
' Hello ' + name + msg;
}
So how do you tune it when you call it, you can test (' Eric '), Test (' Eric ', ' Welcome to JavaScript '), and even you can pass any number of arguments to it, and the type is random. It's such a wonderful thing to learn c++/c# Or a Java classmate might think of a function overload. But what I'm going to tell you is that there is no function overload in JavaScript, and if you define two functions with the same name, the function defined first will be overwritten by the later definition, meaning that the result you want can only be obtained from the function defined later.
Well, to go back to it, why is the function of JavaScript so random, so let's take a look at where the parameters are stored. In fact, in its internal implementation, all the passed arguments exist in an array. This array is always received by the function, regardless of what parameters the array contains. It's a good idea now, we have defined a function, when the parameters can be randomly transmitted, you pass how much it is to you into the array, if not, then your formal parameters are all ' undefined ', which does not have any grammatical errors, but the semantic is not easy to say.
Well,,,,,,,, for the first time to write a blog, little brother, let everyone laugh, I hope this blog can help you a little bit ....
I Love you,guys!