javascript - Are there any popular names for actual parameters and formal parameters? Especially formal parameters
ringa_lee
ringa_lee 2017-07-05 10:57:24
0
2
987

I have never understood it. For actual parameters, I will add $ in front of the jquery object and use camel case to name it. For other string arrays, I will use str/arr and use camel case to name it. This actual parameter is not bad. I don’t know how to name the key formal parameters. Sometimes I name them the same as the actual parameters. For example, the actual parameter is $this=$(this), and my formal parameter is $this or obj/ele. I don’t know how to name it. I found that other people named them differently, which was very confusing. Also, maybe there is something wrong with my understanding of actual parameters and formal parameters. For example, $(this) in var $this=$(this) is an actual parameter, and the x in function funName (x){} is a formal parameter, which is Do you understand this?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
小葫芦

There are no rules, just name it whatever you want, don’t violate the basic naming rules.

function a(param) {  // param形参
    console.log(param);
}
a(123); // 123实参
typecho

You can understand that the formal parameter is the definition of the method or function, and the actual parameter is the parameter passed when calling the method or function. This parameter is the actual parameter. The actual parameter will be received by the formal parameter defined by the function or method. It is that simple. !

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template