2019-04-21 11:50:48 +08:00

24 lines
2.7 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<article id="wikiArticle">
<div></div>
<div> </div>
<div>以下是javaScript 1.7版本的更新日志,这个版本被包括在 <a href="/en-US/Firefox/Releases/2">Firefox 2</a> (2006年10月)。</div>
<p> </p>
<p>JavaScript 1.7是一个引出了一些新特性的语言更新尤其是generatoriterator数组推导式 <code>let</code> 表达式和解构赋值。</p>
<h2 id="使用_JavaScript_1.7">使用 JavaScript 1.7</h2>
<p>为了使用 JavaScript 1.7的一些新特性,你需要明确指出你希望使用 JavaScript 1.7。在HTML 或XUL code中使用</p>
<pre><code class="language-html"><code>&lt;script type="application/javascript;version=1.7"&gt;&lt;/script&gt;</code>
</code></pre>
<p>当使用 <a href="/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell" title="en-US/docs/Introduction_to_the_JavaScript_shell">JavaScript shell</a>的时候,你需要用 <code>-version 170</code> 开启命令行或者用<code>version()</code> 函数来设置你想使用的JavaScript版本。</p>
<pre><code class="language-js">version(170);
</code></pre>
<p>你需要指定1.7版本来使用新的“yield”和“let”关键字因为现存的代码可能用它们当变量或者函数名用。没有涉及到新关键词的特性比如解构赋值和数组推导式可以直接使用而不需要指明JavaScript版本。</p>
<h2 id="JavaScript_1.7的新特性">JavaScript 1.7的新特性</h2>
<p>以下JavaScript 1.7的新特性目前还不是ECMA-262标准的一部分。在最近的Firefox版本中会根据ECMAScipt6中的描述来实现这些功能。具体内容见这些参考页面。</p>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators">Iterators and generators</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions#Differences_to_the_older_JS1.7.2FJS1.8_comprehensions">Array comprehensions</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/let"><code>let</code> 声明</a>(Gecko 41中抛弃了 <code>let</code> 声明,见 <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1023609" rel="noopener" title="FIXED: Remove SpiderMonkey support for let expressions">bug 1023609</a>)</li>
<li><a href="https://developer.mozilla.org/en-US/docs/const">const 声明</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">解构赋值</a>(Gecko 40中不再支持JS1.7风格的for-in解构<a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1083498" rel="noopener" title="FIXED: Remove SpiderMonkey support for destructuring for-in (JS1.7-only language extension)">bug 1083498</a>)</li>
</ul>
</article>