哪些浏览器目前支持JavaScript的“let”关键字? [英] What browsers currently support JavaScript's 'let' keyword?
问题描述
我正在开发一个应用程序,不必担心Internet Explorer,并且正在研究A +级别浏览器中不在Internet Explorer 1中的一些功能。
我想玩的这些功能之一是 JavaScript的let关键字
我似乎无法得到他们的任何'让'的例子在Firefox 3.6 用户代理字符串:Mozilla / 5.0(Windows; U; Windows NT 5.1;美国; rv:1.9.2)Gecko / 20100115 Firefox / 3.6(.NET CLR 3.5.30729))。我得到 SyntaxError:missing;在执行
let foo =bar
。
之前的语句支持let关键字? (或者我做错了什么?)
这些扩展不是ECMA-Standard,它们仅受Mozilla实现。
$ b 在浏览器环境中,您应该在
脚本
标记中包含JavaScript 版本号使用它: < script type =application / javascript; version = 1.7>
var x = 5;
var y = 0;
(x = x + 10,y = 12){
alert(x + y +\\\
);
}
alert((x + y)+\\\
);
< / script>
I'm developing an app and don't have to ever worry about Internet Explorer and was looking into some of the features present in A+ grade browsers that aren't in Internet Explorer1.
One of these features I wanted to play around with is JavaScript's let keyword
I can't seem to get any of their 'let' examples to work in Firefox 3.6 (User-Agent string: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)). I get SyntaxError: missing ; before statement
when executing let foo = "bar"
.
So, what browsers support the let keyword? (Or am I doing something wrong?)
Those extensions are not ECMA-Standard, they are supported only by the Mozilla implementation.
On browser environments you should include the JavaScript version number in your script
tag to use it:
<script type="application/javascript;version=1.7">
var x = 5;
var y = 0;
let (x = x+10, y = 12) {
alert(x+y + "\n");
}
alert((x + y) + "\n");
</script>
这篇关于哪些浏览器目前支持JavaScript的“let”关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!