JavaScript 1.7 新功能的跨浏览器支持是什么?特别是数组推导式和“让"陈述 [英] What is cross browser support for JavaScript 1.7's new features? Specifically array comprehensions and the "let" statement
问题描述
https://developer.mozilla.org/en/New_in_JavaScript_1.7
这些新功能中有很多是从 Python 中借来的,并且可以创建不那么冗长的应用程序,这总是一件好事.你打了多少字
A lot of these new features are borrowed from Python, and would allow the creation of less verbose apps, which is always a good thing. How many times have you typed
for (i = 0; i < arr.length; i++) {
/* ... */
}
对于真正简单的操作?这不是更容易吗:
for really simple operations? Wouldn't this be easier:
[/* ... */ for each (i in arr)]
我认为简洁是件好事.不过,基本上,这一切最终都归结于 IE.
I think brevity is a great thing. Basically, it all comes down to IE in the end, though.
IE 是否支持这些新功能?其他浏览器呢?
Does IE support these new features? What about other browsers?
推荐答案
不,当他们说JavaScript"时,他们的意思是字面意思:Gecko 使用的 ECMAScript 引擎.JScript 和其他引擎 (AFAIK) 不支持这些功能.
No, when they say "JavaScript", they mean it literally: the ECMAScript engine used by Gecko. JScript and other engines (AFAIK) don't support these features.
根据 wikipedia,JavaScript 1.7 实现了 ECMAScript第 3 版"以及所有 JavaScript1.6 增强,加上 Pythonic 生成器和数组推导式 ([a*a for (a in iter)]),带 let 的块作用域,解构赋值 (var [a,b]=[1,2])".所以这些特性不是 ECMAScript 的一部分.
According to wikipedia, JavaScript 1.7 implements ECMAScript "Edition 3 plus all JavaScript 1.6 enhancements, plus Pythonic generators and array comprehensions ([a*a for (a in iter)]), block scope with let, destructuring assignment (var [a,b]=[1,2])". So these features are not part of ECMAScript.
这篇关于JavaScript 1.7 新功能的跨浏览器支持是什么?特别是数组推导式和“让"陈述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!