简体   繁体   English

如何在ES6中使用全局let声明?

[英]How can use global let declaration in ES6?

How I can use ES6 global let declaration? 如何使用ES6全局let声明?

let video = document.getElementById("video");
let button = document.getElementById("controllbutton");

The Above code causes Error that SyntaxError: missing ; before statement 上面的代码导致Error SyntaxError: missing ; before statement SyntaxError: missing ; before statement on Firefox. 在Firefox上的SyntaxError: missing ; before statement

Why above code causes Syntax Error? 为什么上述代码会导致语法错误?

Are you transpiling? 您在转载吗? I don't see browser support for FF for this feature: https://kangax.github.io/compat-table/es6/ 我没有看到浏览器对此功能提供FF支持: https : //kangax.github.io/compat-table/es6/

我在脚本标记中添加了type="application/javascript;version=1.7" ,它解决了语法错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM