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

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">TypeError: "x" is not a function
</pre>
<pre><code class="language-javascript">TypeError: "x" is not a function
</code></pre>
<h2 id="错误类型">错误类型</h2>
<p><a href="Reference/Global_Objects/TypeError" title="TypeError类型错误 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a></p>
<h2 id="哪里出错了">哪里出错了?</h2>
@@ -24,30 +24,30 @@
<h2 id="例子">例子</h2>
<h3 id="函数的名称错误">函数的名称错误</h3>
<p>函数的名称拼写错误,这种情况是经常发生的:</p>
<pre class="brush: js example-bad">var x = document.getElementByID("foo");
<pre><code class="language-js example-bad">var x = document.getElementByID("foo");
// TypeError: document.getElementByID is not a function
</pre>
</code></pre>
<p>正确的方法名应该是 <code>getElementByI<strong>d</strong></code></p>
<pre class="brush: js example-good">var x = document.getElementById("foo");
</pre>
<pre><code class="language-js example-good">var x = document.getElementById("foo");
</code></pre>
<h3 id="调用Object类型中不存在的方法">调用Object类型中不存在的方法</h3>
<p>对于某些特殊的方法,它只属于某些特定的原生对象中,你必须提供一个回调函数才能正常运行。例如:这里调用了一个 <a href="Reference/Global_Objects/Array/map" title="map() 方法创建一个新数组,其结果是该数组中的每个元素都调用一个提供的函数后返回的结果。"><code>Array.prototype.map()</code></a> 方法,但是这方法只能被 <a href="Reference/Array" title="REDIRECT Array"><code>Array</code></a> 对象所调用。 </p>
<pre class="brush: js example-bad">var obj = { a: 13, b: 37, c: 42 };
<pre><code class="language-js example-bad">var obj = { a: 13, b: 37, c: 42 };
obj.map(function(num) {
return num * 2;
});
// TypeError: obj.map is not a function</pre>
// TypeError: obj.map is not a function</code></pre>
<p>正确的做法,使用一个数组来代替:</p>
<pre class="brush: js example-good">var numbers = [1, 4, 9];
<pre><code class="language-js example-good">var numbers = [1, 4, 9];
numbers.map(function(num) {
return num * 2;
});
// Array [ 2, 8, 18 ]
</pre>
</code></pre>
<h2 id="相关">相关</h2>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Functions">Functions</a></li>