diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/functions')
-rw-r--r-- | files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html | 2 | ||||
-rw-r--r-- | files/zh-cn/web/javascript/reference/functions/arguments/index.html | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html index d814e6ce1f..a2847f3683 100644 --- a/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html +++ b/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html @@ -88,7 +88,7 @@ sillyFunction();</pre> <p>递归函数必须能够引用它本身。很典型的,函数通过自己的名字调用自己。然而,匿名函数 (通过 <a href="/en-US/docs/JavaScript/Reference/Operators/function" title="JavaScript/Reference/Operators/Special/function">函数表达式</a> 或者 <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="JavaScript/Reference/Global_Objects/Function">函数构造器 </a>创建</code>) 没有名称。因此如果没有可访问的变量指向该函数,唯一能引用它的方式就是通过 <code>arguments.callee</code>。</p> -<p>下面的例子定义了一个函数,按流程,定义并返回了一个阶乘函数。该例并不是很实用,并且几乎都能够用 <a href="/en-US/docs/JavaScript/Reference/Operators/function" style="line-height: 1.5;" title="JavaScript/Reference/Operators/Special/function">命名函数表达式</a> 实现同样结果的例子, and there are nearly no cases where the same result cannot be achieved with .</p> +<p>下面的例子定义了一个函数,按流程,定义并返回了一个阶乘函数。该例并不是很实用,并且几乎都能够用 <a href="/en-US/docs/JavaScript/Reference/Operators/function" title="JavaScript/Reference/Operators/Special/function">命名函数表达式</a> 实现同样结果的例子, and there are nearly no cases where the same result cannot be achieved with .</p> <pre class="brush: js">function create() { return function(n) { diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/index.html index 501794e7f3..04d14b0b4f 100644 --- a/files/zh-cn/web/javascript/reference/functions/arguments/index.html +++ b/files/zh-cn/web/javascript/reference/functions/arguments/index.html @@ -149,7 +149,7 @@ myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");</pre> <p>这个例子定义了一个函数通过一个字符串来创建HTML列表。这个函数唯一正式声明了的参数是一个字符。当该参数为 "<code>u</code>" 时,创建一个无序列表 (项目列表);当该参数为 "<code>o</code>" 时,则创建一个有序列表 (编号列表)。该函数定义如下:</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; font-size: 14px; white-space: normal;"><code class="language-js" style="direction: ltr; white-space: pre;">function list(type) { +<pre class="brush:js language-js"><code class="language-js">function list(type) { var result = "<" + type + "l><li>"; var args = Array.prototype.slice.call(arguments, 1); result += args.join("</li><li>"); @@ -160,7 +160,7 @@ myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");</pre> <p>你可以传递任意数量的参数到该函数,并将每个参数作为一个项添加到指定类型的列表中。例如:</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; font-size: 14px; white-space: normal;"><code class="language-js" style="direction: ltr; white-space: pre;">var listHTML = list("u", "One", "Two", "Three"); +<pre class="brush:js language-js"><code class="language-js">var listHTML = list("u", "One", "Two", "Three"); /* listHTML is: |