JS error #39;redeclaration#39; of var when it#39;s first line in program?(当它是程序的第一行时,JS 错误“重新声明var?)
问题描述
SCRPT5039:重新声明 const 属性行 1 字符 1
line1: var editObj = null;
这是文件的开头,我检查以确保该变量不在任何其他被调用的 js 文件中.是说我以后重新声明吗?(如果是这样,那行参考没有用)或者这有什么问题?
This is the beginning of the file and I checked to make sure that variable is not in any other js files being called. Is it saying that I redeclare it later? (if so that line reference is not useful) or what is wrong with this?
推荐答案
已修复.反正对我来说.我在重新声明错误之前得到了这个错误:
Fixed it. For me, anyway. I got this error before the redeclaration error:
HTML1113: Document mode restart from Quirks to IE9 Standards
这表明 IE 发现了它认为的错误,因此以 Quirks 模式再次加载页面.加载页面两次使它认为所有内容都被声明了两次.所以解决办法就是找出IE不喜欢的东西.
This suggests that IE finds what it thinks is an error, so loads the page again in Quirks mode. Loading the page twice makes it think everything is declared twice. So the solution is to find what IE didn't like.
首先,我通过 在线 HTML 验证器 运行该页面.接下来我通过 jsLint 运行我的 javascript.毕竟,IE9 看起来很开心.作为奖励,我有更好的代码质量.我希望.
First I ran the page through the online HTML validator. Next I ran my javascript through jsLint. After all that, IE9 seemed happy. And as a bonus I have better quality code. I hope.
这篇关于当它是程序的第一行时,JS 错误“重新声明"var?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:当它是程序的第一行时,JS 错误“重新声明"var?


基础教程推荐
- 响应更改 div 大小保持纵横比 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 在for循环中使用setTimeout 2022-01-01
- 动态更新多个选择框 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01