语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -1,8 +1,8 @@
<article id="wikiArticle">
<div></div>
<h2 id="消息提示">消息提示</h2>
<pre class="syntaxbox">SyntaxError: "x" is a reserved identifier (Firefox)
SyntaxError: Unexpected reserved word (Chrome)</pre>
<pre><code class="language-javascript">SyntaxError: "x" is a reserved identifier (Firefox)
SyntaxError: Unexpected reserved word (Chrome)</code></pre>
<h2 id="错误类型">错误类型</h2>
<p><a href="Reference/Global_Objects/SyntaxError" title="SyntaxError 对象代表尝试解析语法上不合法的代码的错误。"><code>SyntaxError</code></a></p>
<h2 id="哪里出错了?">哪里出错了?</h2>
@@ -24,25 +24,25 @@ SyntaxError: Unexpected reserved word (Chrome)</pre>
<h2 id="示例">示例</h2>
<h3 id="严格与非严格模式下的保留字">严格与非严格模式下的保留字</h3>
<p>在两种模式下,<code>enum</code> 标识符都会作为保留字。</p>
<pre class="brush: js example-bad">var enum = { RED: 0, GREEN: 1, BLUE: 2 };
<pre><code class="language-js example-bad">var enum = { RED: 0, GREEN: 1, BLUE: 2 };
// SyntaxError: enum is a reserved identifier
</pre>
</code></pre>
<p>在严格模式下,会有更多的保留字。</p>
<pre class="brush: js example-bad">"use strict";
<pre><code class="language-js example-bad">"use strict";
var package = ["potatoes", "rice", "fries"];
// SyntaxError: package is a reserved identifier
</pre>
</code></pre>
<p>你需要对上述变量重新命名。</p>
<pre class="brush: js example-good">var colorEnum = { RED: 0, GREEN: 1, BLUE: 2 };
var list = ["potatoes", "rice", "fries"];</pre>
<pre><code class="language-js example-good">var colorEnum = { RED: 0, GREEN: 1, BLUE: 2 };
var list = ["potatoes", "rice", "fries"];</code></pre>
<h3 id="升级旧版本浏览器">升级旧版本浏览器</h3>
<p>假如你还在使用尚未支持 let 或 class 等特性的旧版本浏览器,你应该将它们升级到支持这些新语言特性的版本。</p>
<pre class="brush: js">"use strict";
<pre><code class="language-javascript">"use strict";
class DocArchiver {}
// SyntaxError: class is a reserved identifier
//(只会在旧版本浏览器中抛出,例如 Firefox 44 或更老的版本)
</pre>
</code></pre>
<h2 id="相关内容">相关内容</h2>
<ul>
<li><a class="external" href="http://wiki.c2.com/?GoodVariableNames" rel="noopener">Good variable names</a></li>