diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/statements/function/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/statements/function/index.html | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/statements/function/index.html b/files/zh-cn/web/javascript/reference/statements/function/index.html index cb225706eb..13efc35a6d 100644 --- a/files/zh-cn/web/javascript/reference/statements/function/index.html +++ b/files/zh-cn/web/javascript/reference/statements/function/index.html @@ -90,7 +90,7 @@ if (true) { <p>JavaScript 中的<strong>函数声明</strong>被提升到了<strong>函数定义</strong>。你可以在函数声明之前使用该函数:</p> -<pre class="brush: js language-js">hoisted(); // logs "foo" +<pre class="brush: js">hoisted(); // logs "foo" function hoisted() { console.log('foo'); @@ -98,10 +98,10 @@ function hoisted() { </pre> <div class="note"> -<p>注意 :<strong>函数表达式</strong>{{jsxref("Operators/function", "function expressions")}} 不会被提升:</p> +<p><strong>备注:</strong><strong>函数表达式</strong>{{jsxref("Operators/function", "function expressions")}} 不会被提升:</p> </div> -<pre class="brush: js language-js">notHoisted(); // TypeError: notHoisted is not a function +<pre class="brush: js">notHoisted(); // TypeError: notHoisted is not a function var notHoisted = function() { console.log('bar'); @@ -114,7 +114,7 @@ var notHoisted = function() { <p>下面的代码声明了一个函数,该函数返回了销售的总金额, 参数是产品a,b,c分别的销售的数量.</p> -<pre class="brush: js language-js">function calc_sales(units_a, units_b, units_c) {functionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunction +<pre class="brush: js">function calc_sales(units_a, units_b, units_c) {functionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunction return units_a*79 + units_b * 129 + units_c * 699; }</pre> |