简体   繁体   中英

How can use global let declaration in ES6?

How I can use ES6 global let declaration?

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

The Above code causes Error that SyntaxError: missing ; before statement SyntaxError: missing ; before statement on Firefox.

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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