javascript let not working in various browsers

旧城冷巷雨未停 提交于 2019-12-11 20:08:31

问题


let doesnt't work in some browsers. Not in their interpeters/ web consoles either. Why?

(originally I thought there was an inconsistency b/t the browser interpeter and the jsFiddle, but it turns out not to be true, just bad tests on my part.)


回答1:


It is a non-standard keyword introduced in JS 1.7, not necessarily implemented in different browsers.

https://developer.mozilla.org/en/JavaScript/Reference/Statements/let




回答2:


In order to use some of the new features of JavaScript 1.7, you need to specify that you wish to use JavaScript 1.7. In HTML or XUL code, use

<script type="application/javascript;version=1.7"/>


来源:https://stackoverflow.com/questions/10388519/javascript-let-not-working-in-various-browsers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!