Firefox 中 ECMAScript 6 的实现情况

  • 版本网址缩略名: JavaScript/ECMAScript_6_support_in_Mozilla
  • 版本标题: ECMAScript 6 support in Mozilla
  • 版本 id: 387521
  • 创建于:
  • 创建者: ziyunfei
  • 是否是当前版本?
  • 评论

修订内容

ECMAScript 6是ECMAScript规范的下一版本,开发代号为"Harmony" 或者 "ES.next".规范草案可以在官方wiki上找到.如果你有任何关于此规范的反馈,可以在es-discuss进行讨论

每个特性都被标记了"TC39共识",有三个等级:

已达成共识 讨论中 有争议

这三个等级分别意味着:

  • 已达成共识: 对于特性的设计基本达成了共识.
  • 讨论中: 对于特性的设计基本达成了共识,但特性某个方面还在讨论中.
  • 有争议: 关于特性的设计,TC39成员之间有明显的争议.

Firefox已经支持的ECMAScript 6特性

语法

特性名称 实现该特性的Firefox版本 说明 TC39共识
const ? 符合现行规范:const应该类似 let,拥有块级作用域,而现在的实现不是.  
let (global scope) ? 符合现行规范  
let (local scope) ? 符合现行规范  
Destructuring assignment JS 1.7 符合现行规范  
for...of statement {{fx_minversion_inline("13")}}    
Iterators and generators ? 符合现行规范  
Rest parameters {{fx_minversion_inline("15")}}    
Default parameters {{fx_minversion_inline("15")}}    
Spread operator of Array {{fx_minversion_inline("16")}}    
Arrow functions {{fx_minversion_inline("22")}}    

标准库

特性名称 实现该特性的Firefox版本 说明 TC39共识
Map {{fx_minversion_inline("13")}} 一种新的集合类型  
Map对象可迭代 {{fx_minversion_inline("17")}} 使用for-of进行迭代  
Map对象的方法   forEach, entries, keys, values方法  
Set {{fx_minversion_inline("13")}} 一种新的集合类型  
Set对象可迭代 {{fx_minversion_inline("17")}} 使用for-of进行迭代  
Set methods   forEach, entries, keys, values方法  
Array对象可迭代 {{fx_minversion_inline("13")}} 使用for-of进行迭代  
WeakMap {{fx_minversion_inline("6")}} 一种新的集合类型  
weakmap.clear() {{fx_minversion_inline("20")}}    
Proxy {{fx_minversion_inline("18")}}    
RegExp sticky (y) flag ?    
Number.isNaN() {{fx_minversion_inline("16")}}    
Number.isFinite() {{fx_minversion_inline("16")}}    
Number.toInteger() {{fx_minversion_inline("16")}}    
Number.isInteger() {{fx_minversion_inline("16")}}    
string.startsWith() {{fx_minversion_inline("17")}}    
string.endsWith() {{fx_minversion_inline("17")}}    
string.contains() {{fx_minversion_inline("17")}}    
Object.is      
Math.imul {{fx_minversion_inline("20")}} 类c的32位整数乘法  

Firefox仍未支持的ECMAScript 6特性

  • isisnt运算符 {{obsolete_inline()}}
  • 新的Math函数(log10, log2, log1p, expm1, cosh, sinh, tanh, acosh, asinh, atanh, hypot, trunc, sign)
  • 模块

相关链接

修订版来源

<p>ECMAScript 6是ECMAScript规范的下一版本,开发代号为"Harmony" 或者 "ES.next".<a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts">规范草案可以在官方wiki上找到</a>.如果你有任何关于此规范的反馈,可以在<a class="external" href="https://mail.mozilla.org/listinfo/es-discuss">es-discuss</a>进行讨论</p>
<p>每个特性都被标记了"TC39共识",有三个等级:</p>
<table>
  <tbody>
    <tr>
      <td style="background-color: green;"><span style="color: rgb(240, 255, 240);">已达成共识</span></td>
      <td style="background-color: yellow;">讨论中</td>
      <td style="background-color: orange;">有争议</td>
    </tr>
  </tbody>
</table>
<p>这三个等级分别意味着:</p>
<ul>
  <li><strong>已达成共识:</strong> 对于特性的设计基本达成了共识.</li>
  <li><strong>讨论中:</strong> 对于特性的设计基本达成了共识,但特性某个方面还在讨论中.</li>
  <li><strong>有争议:</strong> 关于特性的设计,TC39成员之间有明显的争议.</li>
</ul>
<h2 id="Firefox.E5.B7.B2.E7.BB.8F.E6.94.AF.E6.8C.81.E7.9A.84ECMAScript_6.E7.89.B9.E6.80.A7">Firefox已经支持的ECMAScript 6特性</h2>
<h3 id="Syntax">语法</h3>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">特性名称</th>
      <th scope="col">实现该特性的Firefox版本</th>
      <th scope="col">说明</th>
      <th scope="col">TC39共识</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Statements/const" title="const">const</a></code></td>
      <td>?</td>
      <td><span><span>不</span><span>符合</span><span>现行规范</span></span>:const应该类似 let,拥有块级作用域,而现在的实现不是.</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Statements/let" title="let">let</a></code> (global scope)</td>
      <td>?</td>
      <td><span><span>不</span><span>符合</span><span>现行规范</span></span></td>
      <td style="background-color: yellow;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Statements/let" title="let">let</a></code> (local scope)</td>
      <td>?</td>
      <td><span><span>不</span><span>符合</span><span>现行规范</span></span></td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/JavaScript/New_in_JavaScript/1.7#Destructuring_assignment_%28Merge_into_own_page.2Fsection%29" title="https://developer.mozilla.org/en-US/New_in_JavaScript_1.7#Destructuring_assignment_%28Merge_into_own_page.2Fsection%29">Destructuring assignment</a></td>
      <td>JS 1.7</td>
      <td><span><span>不</span><span>符合</span><span>现行规范</span></span></td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Statements/for...of" title="for...of">for...of</a></code> statement</td>
      <td>{{fx_minversion_inline("13")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/JavaScript/Guide/Iterators_and_Generators" title="Iterators and generators">Iterators and generators</a></td>
      <td>?</td>
      <td><span><span>不</span><span>符合</span><span>现行规范</span></span></td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/JavaScript/Reference/rest_parameters" title="rest parameters">Rest parameters</a></td>
      <td>{{fx_minversion_inline("15")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/docs/JavaScript/Reference/default_parameters" title="default_parameters">Default parameters</a></td>
      <td>{{fx_minversion_inline("15")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/docs/JavaScript/Reference/Spread_operator" title="Spread_operator"><span class="external">Spread operator</span></a> of Array</td>
      <td>{{fx_minversion_inline("16")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/docs/JavaScript/Reference/arrow_functions" title="Arrow functions">Arrow functions</a></td>
      <td>{{fx_minversion_inline("22")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
  </tbody>
</table>
<h3 id=".E6.A0.87.E5.87.86.E5.BA.93">标准库</h3>
<table class="standard-table">
  <tbody>
    <tr>
      <th scope="col">特性名称</th>
      <th scope="col">实现该特性的Firefox版本</th>
      <th scope="col">说明</th>
      <th scope="col">TC39共识</th>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Map" title="en-US/JavaScript/Reference/Global_Objects/Map">Map</a></code></td>
      <td>{{fx_minversion_inline("13")}}</td>
      <td>一种新的集合类型</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Map" title="en-US/JavaScript/Reference/Global_Objects/Map">Map对象可迭代</a></code></td>
      <td>{{fx_minversion_inline("17")}}</td>
      <td>使用for-of进行迭代</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Map" title="en-US/JavaScript/Reference/Global_Objects/Map">Map对象的方法</a></code></td>
      <td>&nbsp;</td>
      <td>forEach, entries, keys, values方法</td>
      <td style="background-color: yellow;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Set" title="en-US/JavaScript/Reference/Global_Objects/Set">Set</a></code></td>
      <td>{{fx_minversion_inline("13")}}</td>
      <td>一种新的集合类型</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Set" title="en-US/JavaScript/Reference/Global_Objects/Set">Set对象可迭代</a></code></td>
      <td>{{fx_minversion_inline("17")}}</td>
      <td>使用for-of进行迭代</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Set" title="en-US/JavaScript/Reference/Global_Objects/Set">Set methods</a></code></td>
      <td>&nbsp;</td>
      <td>forEach, entries, keys, values方法</td>
      <td style="background-color: yellow;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Array" title="en-US/JavaScript/Reference/Global_Objects/Array">Array对象可迭代</a></code></td>
      <td>{{fx_minversion_inline("13")}}</td>
      <td>使用for-of进行迭代</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/WeakMap" title="WeakMap">WeakMap</a></code></td>
      <td>{{fx_minversion_inline("6")}}</td>
      <td>一种新的集合类型</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/WeakMap" title="WeakMap">weakmap.clear()</a></code></td>
      <td>{{fx_minversion_inline("20")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: orange;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/JavaScript/Reference/Global_Objects/Proxy" title="Proxy">Proxy</a></code></td>
      <td>{{fx_minversion_inline("18")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: yellow;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/JavaScript/Reference/Global_Objects/RegExp" title="RegExp"><span class="external text"><code>RegExp</code> sticky (<code>y</code>) flag</span></a></td>
      <td>?</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Number/isNaN" title="/en-US/docs/JavaScript/Reference/Global_Objects/Number/isNaN">Number.isNaN()</a></code></td>
      <td>{{fx_minversion_inline("16")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code>Number.isFinite()</code></td>
      <td>{{fx_minversion_inline("16")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code>Number.toInteger()</code></td>
      <td>{{fx_minversion_inline("16")}}</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><code>Number.isInteger()</code></td>
      <td>{{fx_minversion_inline("16")}}</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String/startsWith" title="/en-US/docs/JavaScript/Reference/Global_Objects/String/startsWith">string.startsWith()</a></code></td>
      <td>{{fx_minversion_inline("17")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String/endsWith" title="/en-US/docs/JavaScript/Reference/Global_Objects/String/endsWith">string.endsWith()</a></code></td>
      <td>{{fx_minversion_inline("17")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String/contains" title="/en-US/docs/JavaScript/Reference/Global_Objects/String/contains">string.contains()</a></code></td>
      <td>{{fx_minversion_inline("17")}}</td>
      <td>&nbsp;</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/is" title="/en-US/docs/JavaScript/Reference/Global_Objects/Object/is">Object.is</a></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td style="background-color: yellow;">&nbsp;</td>
    </tr>
    <tr>
      <td><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Math/imul" title="/en-US/docs/JavaScript/Reference/Global_Objects/Math/imul">Math.imul</a></td>
      <td>{{fx_minversion_inline("20")}}</td>
      <td>类c的32位整数乘法</td>
      <td style="background-color: green;">&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Firefox.E4.BB.8D.E6.9C.AA.E6.94.AF.E6.8C.81.E7.9A.84ECMAScript_6.E7.89.B9.E6.80.A7">Firefox仍未支持的ECMAScript 6特性</h2>
<ul>
  <li><code>is</code>和<code>isnt运算符</code> {{obsolete_inline()}}</li>
  <li>新的<code>Math函数</code>(<code>log10</code>, <code>log2</code>, <code>log1p</code>, <code>expm1</code>, <code>cosh</code>, <code>sinh</code>, <code>tanh</code>, <code>acosh</code>, <code>asinh</code>, <code>atanh</code>, <code>hypot</code>, <code>trunc</code>, <code>sign</code>)</li>
  <li>模块</li>
</ul>
<h2 id="See_also">相关链接</h2>
<ul>
  <li><a class="external" href="http://www.ecmascript.org/" title="http://www.ecmascript.org/">ECMAScript官网</a></li>
  <li><a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts" title="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts">ECMAScript 6规范草案</a></li>
  <li><a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=694100" title="https://bugzilla.mozilla.org/show_bug.cgi?id=694100">Mozilla Harmony tracking bug</a></li>
</ul>
恢复到这个版本