Javascript js文件中的_构造存在问题
我在js文件中看到了上面的脚本 问题:Javascript js文件中的_构造存在问题,javascript,jquery,Javascript,Jquery,我在js文件中看到了上面的脚本 问题: 这条线是什么意思\构造:函数(e)?这是否等于构造函数:函数(e)?我在php文件中看到了\u构造,但我从未在js文件中看到过它 我的猜测是,它只是一种内部约定,用于将逻辑与实际构造函数分离,并能够在需要时将其作为方法调用。例如,其他库使用\u init ! function (d, b, c, a) { Velop.AssignmentQuestionAnswerHandler = function (e) { this.__co
这条线是什么意思<代码>\构造:函数(e)?这是否等于构造函数:函数(e)?我在php文件中看到了
\u构造
,但我从未在js文件中看到过它 我的猜测是,它只是一种内部约定,用于将逻辑与实际构造函数分离,并能够在需要时将其作为方法调用。例如,其他库使用\u init
! function (d, b, c, a) {
Velop.AssignmentQuestionAnswerHandler = function (e) {
this.__construct(e)
};
Velop.AssignmentQuestionAnswerHandler.prototype = {
__construct: function (e) {
this.clientAction = Velop.resolveClientAction("client", true);
this.sectionIdAction = XenForo.getAction("section");
this.$input = e;
this.assignmentQuestionControl = e.closest(".AssignmentQuestionAnswerHandler");
this.$input.change(d.context(this, "save"));
this.lastValue = null
},
...
\uu构造本身在JavaScript中没有任何意义。另外,它位于一个对象中,在这个对象中,键可以被命名为任何您想要的名称。这似乎是某种(奇怪的)构造函数。使用此._构造,可以从函数外部访问构造函数
通常用下划线标记内部函数…:) \uu construct
在Javascript中没有特殊意义,只是有人选择了这个名称。Javascript中没有构造函数的概念。它只是一个使用下划线的函数声明。
function Class(e) {
this.__construct(e);
}