我正在查看似乎声明一个需要调用运行的函数的代码.此函数在匿名函数中声明.这是不是意味着该块之外的任何东西都无法访问该函数?
(function () { var _d = vjo.dsf.Eventdispatcher; var _r = vjo.Registry; function $1(p0) { return function (event) { return this.onSubmit(p0,event); }; }; })();
为什么有人会这样做?
我不确定此代码中$的目的/相关性.
解决方法
“Doesn’t this mean that the function will be inaccessible to anything outside of this block?”
是的,它确实.
“Why would someone do this?”
通常因为它包含仅供内部使用的代码,但在您的示例中,永远不会调用该函数.
“I am not of the purpose/relevance of “$” in this code.”
没有相关性.只是另一个有效的变量字符