From 012ee621791b6895e637f96e6523027951768f25 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:03:27 +0800 Subject: remove inline style for zh-CN --- .../javascript/reference/statements/debugger/index.html | 4 ++-- .../javascript/reference/statements/do...while/index.html | 2 +- .../javascript/reference/statements/for...in/index.html | 4 ++-- .../javascript/reference/statements/function/index.html | 14 +++++++------- .../reference/statements/function_star_/index.html | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/statements') diff --git a/files/zh-cn/web/javascript/reference/statements/debugger/index.html b/files/zh-cn/web/javascript/reference/statements/debugger/index.html index 2a54579002..0018dc056c 100644 --- a/files/zh-cn/web/javascript/reference/statements/debugger/index.html +++ b/files/zh-cn/web/javascript/reference/statements/debugger/index.html @@ -12,14 +12,14 @@ translation_of: Web/JavaScript/Reference/Statements/debugger

语法

-
debugger;
+
debugger;
 

示例

下面的例子演示了一个包含 debugger 语句的函数,当函数被调用时,会尝试调用一个可用的调试器进行调试。

-
function potentiallyBuggyCode() {
+
function potentiallyBuggyCode() {
     debugger;
     // do potentially buggy stuff to examine, step through, etc.
 }
diff --git a/files/zh-cn/web/javascript/reference/statements/do...while/index.html b/files/zh-cn/web/javascript/reference/statements/do...while/index.html index 714c0e807e..89a850f722 100644 --- a/files/zh-cn/web/javascript/reference/statements/do...while/index.html +++ b/files/zh-cn/web/javascript/reference/statements/do...while/index.html @@ -21,7 +21,7 @@ while (condition);
statement
-
执行至少一次的语句,并在每次 condition 值为真时重新执行。想执行多行语句,可使用{{jsxref("Statements/block", "block")}}语句({ ... })包裹这些语句。
+
执行至少一次的语句,并在每次 condition 值为真时重新执行。想执行多行语句,可使用{{jsxref("Statements/block", "block")}}语句({ ... })包裹这些语句。
diff --git a/files/zh-cn/web/javascript/reference/statements/for...in/index.html b/files/zh-cn/web/javascript/reference/statements/for...in/index.html index 8b3b346fcc..4bb666e930 100644 --- a/files/zh-cn/web/javascript/reference/statements/for...in/index.html +++ b/files/zh-cn/web/javascript/reference/statements/for...in/index.html @@ -27,13 +27,13 @@ translation_of: Web/JavaScript/Reference/Statements/for...in

-

数组迭代和 for...in

+

数组迭代和 for...in

提示:for...in不应该用于迭代一个关注索引顺序的 {{jsxref("Array")}}。

-

仅迭代自身的属性

+

仅迭代自身的属性

如果你只要考虑对象本身的属性,而不是它的原型,那么使用 {{jsxref("Object.getOwnPropertyNames", "getOwnPropertyNames()")}} 或执行 {{jsxref("Object.prototype.hasOwnProperty", "hasOwnProperty()")}} 来确定某属性是否是对象本身的属性(也能使用{{jsxref("Object.prototype.propertyIsEnumerable", "propertyIsEnumerable")}})。或者,如果你知道不会有任何外部代码干扰,您可以使用检查方法扩展内置原型。

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 4d8e036a2e..be8920fca8 100644 --- a/files/zh-cn/web/javascript/reference/statements/function/index.html +++ b/files/zh-cn/web/javascript/reference/statements/function/index.html @@ -49,7 +49,7 @@ translation_of: Web/JavaScript/Reference/Statements/function

默认情况下,函数是返回 undefined 的。想要返回一个其他的值,函数必须通过一个 return 语句指定返回值。

-

有条件的创建函数

+

有条件的创建函数

函数可以被有条件来声明,这意味着,函数声明可能出现在一个 if 语句里,但是,这种声明方式在不同的浏览器里可能有不同的效果。因此,不应该在生产环境代码中使用这种声明方式,应该使用函数表达式来代替。

@@ -96,7 +96,7 @@ if (true) {

JavaScript 中的函数声明被提升到了函数定义。你可以在函数声明之前使用该函数:

-
hoisted(); // logs "foo"
+
hoisted(); // logs "foo"
 
 function hoisted() {
   console.log('foo');
@@ -107,7 +107,7 @@ function hoisted() {
 

注意 :函数表达式{{jsxref("Operators/function", "function expressions")}} 不会被提升:

-
notHoisted(); // TypeError: notHoisted is not a function
+
notHoisted(); // TypeError: notHoisted is not a function
 
 var notHoisted = function() {
   console.log('bar');
@@ -120,11 +120,11 @@ var notHoisted = function() {
 
 

下面的代码声明了一个函数,该函数返回了销售的总金额, 参数是产品a,b,c分别的销售的数量.

-
function calc_sales(units_a, units_b, units_c) {functionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunction
+
function calc_sales(units_a, units_b, units_c) {functionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunctionfunction
    return units_a*79 + units_b * 129 + units_c * 699;
 }
-

规范

+

规范

@@ -151,13 +151,13 @@ var notHoisted = function() {
-

浏览器兼容性

+

浏览器兼容性

{{Compat("javascript.statements.function")}}

-

相关链接

+

相关链接

  • {{jsxref("Functions_and_function_scope", "Functions and function scope")}}
  • diff --git a/files/zh-cn/web/javascript/reference/statements/function_star_/index.html b/files/zh-cn/web/javascript/reference/statements/function_star_/index.html index 90794ec0d4..0ee47b290d 100644 --- a/files/zh-cn/web/javascript/reference/statements/function_star_/index.html +++ b/files/zh-cn/web/javascript/reference/statements/function_star_/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Statements/function* ---
    {{jsSidebar("Statements")}}
    -

    function* 这种声明方式(function关键字后跟一个星号)会定义一个生成器函数 (generator function),它返回一个  {{jsxref("Global_Objects/Generator","Generator")}}  对象。

    +

    function* 这种声明方式(function关键字后跟一个星号)会定义一个生成器函数 (generator function),它返回一个  {{jsxref("Global_Objects/Generator","Generator")}}  对象。

    {{EmbedInteractiveExample("pages/js/statement-functionasterisk.html")}}
    -- cgit v1.2.3-54-g00ecf