[英]Is it good practice to define a function with different arguments list from reference in javascript?
For example, I working with a framework that would invoke a custom function like this:例如,我使用的框架会调用自定义 function,如下所示:
var ret = Module_Init(index, clk, obj);
The function Module_Init
should be defined by user. function Module_Init
应由用户定义。 And in my Module_Init
, I only need the first parameter index
.而在我的Module_Init
中,我只需要第一个参数index
。 So I define it like this:所以我这样定义它:
function Module_Init(index)
{
m_Index = index;
// initialize code...
}
It work, but is it a good practice in Javascript?它有效,但在 Javascript 中这是一个好习惯吗?
If you are not going to use them, why put them in the function如果您不打算使用它们,为什么将它们放在 function 中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.