javascript - 为什么 JavaScript 缩小器不使用它分配给“this”的变量
问题描述
当我缩小我的代码时,我注意到缩小器会做一些类似的事情(为了可读性而格式化):
e.prototype.doSomething = function(){
var s=this;
this.anotherThing();
........ //more code
}
为什么它不使用s.anotherThing()
并继续使用this
. 似乎它仅在从我的 doSomething() 函数中的函数或回调的内部范围s
引用时使用。this
解决方案
推荐阅读
- c# - 如何从数据库中获取数组中的数据?
- python - 在字符串 python 中查找带有额外字符的名称
- c++ - 如何确定相对于 x 轴像素范围的像素强度?
- sharepoint - 有没有办法在给定节点下的快速启动中添加 NavigationNode 而不是仅使用 Sharepoint Rest API 的子节点?
- javascript - 为什么在这个特定视图中输入的 onclick 事件不触发?
- webpack - Webpack - HMR 插件在 npm run build/dev 上抛出错误
- scala - 播放框架在启动后立即停止
- java - 在连续 8 次测量到的 GC 抖动后关闭 JVM
- java - 在片段中的 AsyncTask 中使用 Jsoup 获取网页元素(Android 新手)
- tensorflow - 如何在 Cleverhans 中导出 Facenet 的对抗样本?