mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-18 08:54:32 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<article id="wikiArticle">
|
||||
<div></div>
|
||||
<h2 id="信息提示">信息提示</h2>
|
||||
<pre class="syntaxbox">SyntaxError: missing formal parameter (Firefox)
|
||||
</pre>
|
||||
<pre><code class="language-javascript">SyntaxError: missing formal parameter (Firefox)
|
||||
</code></pre>
|
||||
<h2 id="错误类型">错误类型</h2>
|
||||
<p><a href="Reference/Global_Objects/SyntaxError" title="SyntaxError 对象代表尝试解析语法上不合法的代码的错误。"><code>SyntaxError</code></a></p>
|
||||
<h2 id="哪里出错了">哪里出错了?</h2>
|
||||
@@ -10,7 +10,7 @@
|
||||
<p>在 <a class="glossaryLink" href="/en-US/docs/Glossary/JavaScript" title="JavaScript: JavaScript (JS) is a programming language mostly used to dynamically script webpages on the client side, but it is also often utilized on the server-side, using packages such as Node.js.">JavaScript</a> 中,标记符只能由字母、数字、"$" 以及 "_" 构成,并且不能以数字开头。标记符与<strong>字符串</strong>的区别在于字符串是数据,而标记符属于代码的一部分。</p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<p>在构造一个函数的时候,函数参数必须为标记符。下面列举的函数声明都是无效的,因为它们在参数部分使用的是数值:</p>
|
||||
<pre class="brush: js example-bad highlight:[1,6,11]">function square(3) {
|
||||
<pre><code class="language-js example-bad highlight:[1,6,11]">function square(3) {
|
||||
return number * number;
|
||||
};
|
||||
// SyntaxError: missing formal parameter
|
||||
@@ -24,9 +24,9 @@ function log({ obj: "value"}) {
|
||||
console.log(arg)
|
||||
};
|
||||
// SyntaxError: missing formal parameter
|
||||
</pre>
|
||||
</code></pre>
|
||||
<p>需要在函数声明中使用标记符:</p>
|
||||
<pre class="brush: js example-good highlight:[1,5,9]">function square(number) {
|
||||
<pre><code class="language-js example-good highlight:[1,5,9]">function square(number) {
|
||||
return number * number;
|
||||
};
|
||||
|
||||
@@ -36,14 +36,14 @@ function greet(greeting) {
|
||||
|
||||
function log(arg) {
|
||||
console.log(arg)
|
||||
};</pre>
|
||||
};</code></pre>
|
||||
<p>之后可以传入你想要传入的实际参数调用函数:</p>
|
||||
<pre class="brush: js">square(2); // 4
|
||||
<pre><code class="language-javascript">square(2); // 4
|
||||
|
||||
greet("Howdy"); // "Howdy"
|
||||
|
||||
log({obj: "value"}); // Object { obj: "value" }
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="相关内容">相关内容</h2>
|
||||
<ul>
|
||||
<li>Other errors regarding formal parameters:
|
||||
|
||||
Reference in New Issue
Block a user