diff options
author | Irvin <irvinfly@gmail.com> | 2022-02-16 02:03:27 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | 012ee621791b6895e637f96e6523027951768f25 (patch) | |
tree | 29cfacc0d5092af45870dcc74f22feb8b2664fbf /files/zh-cn/web/javascript/guide | |
parent | ba91b017421b001cd226135612a7bd5dfcd88904 (diff) | |
download | translated-content-012ee621791b6895e637f96e6523027951768f25.tar.gz translated-content-012ee621791b6895e637f96e6523027951768f25.tar.bz2 translated-content-012ee621791b6895e637f96e6523027951768f25.zip |
remove inline style for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/guide')
7 files changed, 27 insertions, 33 deletions
diff --git a/files/zh-cn/web/javascript/guide/control_flow_and_error_handling/index.html b/files/zh-cn/web/javascript/guide/control_flow_and_error_handling/index.html index c8cb0eb24b..aa26c47e83 100644 --- a/files/zh-cn/web/javascript/guide/control_flow_and_error_handling/index.html +++ b/files/zh-cn/web/javascript/guide/control_flow_and_error_handling/index.html @@ -31,11 +31,9 @@ translation_of: Web/JavaScript/Guide/Control_flow_and_error_handling <p>语句块通常用于流程控制,如<code>if</code>,<code>for</code>,<code>while</code>等等。</p> -<div style="margin-right: 270px;"> <pre class="brush: js">while (x < 10) { x++; }</pre> -</div> <p>这里<code>{ x++; }</code>就是语句块。</p> diff --git a/files/zh-cn/web/javascript/guide/details_of_the_object_model/index.html b/files/zh-cn/web/javascript/guide/details_of_the_object_model/index.html index 6e8cfdc61d..ef6ace35f4 100644 --- a/files/zh-cn/web/javascript/guide/details_of_the_object_model/index.html +++ b/files/zh-cn/web/javascript/guide/details_of_the_object_model/index.html @@ -91,7 +91,7 @@ translation_of: Web/JavaScript/Guide/Details_of_the_Object_Model <p><img alt="" src="https://mdn.mozillademos.org/files/3060/figure8.1.png"></p> -<div style="display: table-cell; vertical-align: middle; padding: 10px;"> +<div> <ul> <li><code>Employee</code> 具有 <code>name</code> 属性(默认值为空的字符串)和 <code>dept</code> 属性(默认值为 "general")。</li> <li><code>Manager</code> 是 <code>Employee</code>的子类。它添加了 <code>reports</code> 属性(默认值为空的数组,以 <code>Employee</code> 对象数组作为它的值)。</li> @@ -279,7 +279,7 @@ var jane = new Engineer; <p>当 JavaScript 执行 <code>new</code> 操作符时,它会先创建一个普通对象,并将这个普通对象中的 [[prototype]] 指向 <code>WorkerBee.prototype</code> ,然后再把这个普通对象设置为执行 <code>WorkerBee</code> 构造函数时 <code>this</code> 的值。该普通对象的 [[Prototype]] 决定其用于检索属性的原型链。当构造函数执行完成后,所有的属性都被设置完毕,JavaScript 返回之前创建的对象,通过赋值语句将它的引用赋值给变量 <code>mark</code>。</p> -<p>这个过程不会显式的将 <code style="font-size: 14px;">mark</code>所继承的原型链中的属性作为本地属性存放在 <code>mark</code> 对象中。当访问属性时,JavaScript 将首先检查对象自身中是否存在该属性,如果有,则返回该属性的值。如果不存在,JavaScript会检查原型链(使用内置的 [[Prototype]] )。如果原型链中的某个对象包含该属性,则返回这个属性的值。如果遍历整条原型链都没有找到该属性,JavaScript 则认为对象中不存在该属性,返回一个 <code>undefined</code>。这样,<code>mark</code> 对象中将具有如下的属性和对应的值:</p> +<p>这个过程不会显式的将 <code>mark</code>所继承的原型链中的属性作为本地属性存放在 <code>mark</code> 对象中。当访问属性时,JavaScript 将首先检查对象自身中是否存在该属性,如果有,则返回该属性的值。如果不存在,JavaScript会检查原型链(使用内置的 [[Prototype]] )。如果原型链中的某个对象包含该属性,则返回这个属性的值。如果遍历整条原型链都没有找到该属性,JavaScript 则认为对象中不存在该属性,返回一个 <code>undefined</code>。这样,<code>mark</code> 对象中将具有如下的属性和对应的值:</p> <pre class="brush: js">mark.name = ""; mark.dept = "general"; diff --git a/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html b/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html index 7cb835c92b..8f45880006 100644 --- a/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html +++ b/files/zh-cn/web/javascript/guide/expressions_and_operators/index.html @@ -230,7 +230,7 @@ var var2 = 4;</code></pre> <p>除了标准的算术运算符(+, - ,* /),JavaScript还提供了下表中的算术运算符。</p> -<table class="fullwidth-table" style="height: 469px; width: 520px;"> +<table class="fullwidth-table"> <caption>表 3.3 算术运算符</caption> <thead> <tr> @@ -438,7 +438,7 @@ After: 10100000000000000110000000000001</code></pre> <p>移位运算符列表如下。</p> -<p><strong style="font-style: inherit; font-weight: 700;">移位运算符</strong></p> +<p><strong>移位运算符</strong></p> <table class="standard-table"> <thead> @@ -474,9 +474,9 @@ After: 10100000000000000110000000000001</code></pre> <p>逻辑运算符常用于布尔(逻辑)值之间; 当操作数都是布尔值时,返回值也是布尔值。 不过实际上<code>&&</code>和<code>||</code>返回的是一个特定的操作数的值,所以当它用于非布尔值的时候,返回值就可能是非布尔值。 逻辑运算符的描述如下。</p> -<p><strong style="font-style: inherit; font-weight: 700;">逻辑运算符</strong></p> +<p><strong>逻辑运算符</strong></p> -<table class="fullwidth-table" style="height: 190px; width: 1316px;"> +<table class="fullwidth-table"> <thead> <tr> <th scope="col">运算符</th> @@ -786,7 +786,7 @@ if (theDay instanceof Date) { <p>下表列出了描述符的优先级,从最高到最低。</p> -<p><strong style="font-style: inherit; font-weight: 700;">运算符优先级</strong></p> +<p><strong>运算符优先级</strong></p> <table class="standard-table"> <thead> diff --git a/files/zh-cn/web/javascript/guide/functions/index.html b/files/zh-cn/web/javascript/guide/functions/index.html index ab6677c5d9..f80d65ce3b 100644 --- a/files/zh-cn/web/javascript/guide/functions/index.html +++ b/files/zh-cn/web/javascript/guide/functions/index.html @@ -370,7 +370,7 @@ A(1); // logs 6 (1 + 2 + 3)</pre> outside()(10); // returns 20 instead of 10</pre> -<p>命名冲突发生在<code>return x</code>上,<code>inside</code>的参数<code>x</code>和<code>outside</code>变量<code>x</code>发生了冲突。这里的作用链域是{<code style="font-style: normal;">inside</code>, <code style="font-style: normal;">outside</code>, 全局对象}。因此<code>inside</code>的<code>x</code>具有最高优先权,返回了20(<code>inside</code>的<code>x</code>)而不是10(<code>outside</code>的<code>x</code>)。</p> +<p>命名冲突发生在<code>return x</code>上,<code>inside</code>的参数<code>x</code>和<code>outside</code>变量<code>x</code>发生了冲突。这里的作用链域是{<code>inside</code>, <code>outside</code>, 全局对象}。因此<code>inside</code>的<code>x</code>具有最高优先权,返回了20(<code>inside</code>的<code>x</code>)而不是10(<code>outside</code>的<code>x</code>)。</p> <h2 id="闭包">闭包</h2> diff --git a/files/zh-cn/web/javascript/guide/indexed_collections/index.html b/files/zh-cn/web/javascript/guide/indexed_collections/index.html index 67c1afe469..53e12083af 100644 --- a/files/zh-cn/web/javascript/guide/indexed_collections/index.html +++ b/files/zh-cn/web/javascript/guide/indexed_collections/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Guide/Indexed_collections --- <div>{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Regular_Expressions", "Web/JavaScript/Guide/Keyed_Collections")}}</div> -<p>这个章节主要介绍了以索引进行排序的数据集合。包括数组以及类似于数组的数据结构,如<strong style="background-color: #f4f7f8; font-weight: bold;"> {{jsxref("Array")}} </strong>、<strong style="background-color: #f4f7f8; font-weight: bold;">{{jsxref("TypedArray")}} </strong>。</p> +<p>这个章节主要介绍了以索引进行排序的数据集合。包括数组以及类似于数组的数据结构,如<strong> {{jsxref("Array")}} </strong>、<strong>{{jsxref("TypedArray")}} </strong>。</p> <h2 id="数组对象Array_object">数组对象(Array object)</h2> diff --git a/files/zh-cn/web/javascript/guide/regular_expressions/index.html b/files/zh-cn/web/javascript/guide/regular_expressions/index.html index d4b03b82de..5534db8860 100644 --- a/files/zh-cn/web/javascript/guide/regular_expressions/index.html +++ b/files/zh-cn/web/javascript/guide/regular_expressions/index.html @@ -567,33 +567,33 @@ console.log(newstr); <caption>正则表达式标志</caption> <thead> <tr> - <th scope="col" style="white-space: nowrap;">标志</th> - <th scope="col" style="white-space: nowrap;">描述</th> + <th scope="col">标志</th> + <th scope="col">描述</th> </tr> </thead> <tbody> <tr> - <td style="text-align: center;"><code>g</code></td> + <td><code>g</code></td> <td>全局搜索。</td> </tr> <tr> - <td style="text-align: center;"><code>i</code></td> + <td><code>i</code></td> <td>不区分大小写搜索。</td> </tr> <tr> - <td style="text-align: center;"><code>m</code></td> + <td><code>m</code></td> <td>多行搜索。</td> </tr> <tr> - <td style="text-align: center;"><code>s</code></td> + <td><code>s</code></td> <td>允许 <code>.</code> 匹配换行符。</td> </tr> <tr> - <td style="text-align: center;"><code>u</code></td> + <td><code>u</code></td> <td>使用unicode码的模式进行匹配。</td> </tr> <tr> - <td style="text-align: center;"><code>y</code></td> + <td><code>y</code></td> <td>执行“粘性(<code>sticky</code>)”搜索,匹配从目标字符串的当前位置开始。</td> </tr> </tbody> diff --git a/files/zh-cn/web/javascript/guide/working_with_objects/index.html b/files/zh-cn/web/javascript/guide/working_with_objects/index.html index 28f6dd54d5..dbdc3294a6 100644 --- a/files/zh-cn/web/javascript/guide/working_with_objects/index.html +++ b/files/zh-cn/web/javascript/guide/working_with_objects/index.html @@ -24,10 +24,8 @@ translation_of: Web/JavaScript/Guide/Working_with_Objects <p>一个 javascript 对象有很多属性。一个对象的属性可以被解释成一个附加到对象上的变量。对象的属性和普通的 javascript 变量基本没什么区别,仅仅是属性属于某个对象。属性定义了对象的特征(译注:动态语言面向对象的鸭子类型)。你可以通过点符号来访问一个对象的属性。</p> -<div style="margin-right: 270px;"> <pre class="brush: js">objectName.propertyName </pre> -</div> <p>和其他 javascript 变量一样,对象的名字(可以是普通的变量)和属性的名字都是大小写敏感的。你可以在定义一个属性的时候就给它赋值。例如,我们创建一个myCar的对象然后给他三个属性,make,model,year。具体如下所示:</p> @@ -70,16 +68,14 @@ console.log(myObj); <p>你也可以通过存储在变量中的字符串来访问属性:</p> -<div style="width: auto;"> <pre class="brush: js">var propertyName = "make"; -myCar[propertyName] = "Ford"; - -propertyName = "model"; -myCar[propertyName] = "Mustang"; -</pre> -</div> + myCar[propertyName] = "Ford"; + + propertyName = "model"; + myCar[propertyName] = "Mustang"; + </pre> -<p>你可以在 <a class="internal" href="/zh-CN/docs/JavaScript/Guide/Statements#for...in_Statement" style="line-height: 1.5;" title="zh-CN/docs/JavaScript/Guide/Statements#for...in Statement">for...in</a> 语句中使用方括号标记以枚举一个对象的所有属性。为了展示它如何工作,下面的函数当你将对象及其名称作为参数传入时,显示对象的属性:</p> +<p>你可以在 <a class="internal" href="/zh-CN/docs/JavaScript/Guide/Statements#for...in_Statement" title="zh-CN/docs/JavaScript/Guide/Statements#for...in Statement">for...in</a> 语句中使用方括号标记以枚举一个对象的所有属性。为了展示它如何工作,下面的函数当你将对象及其名称作为参数传入时,显示对象的属性:</p> <pre class="brush: js">function showProps(obj, objName) { var result = ""; @@ -147,7 +143,7 @@ myCar.year = 1969 -<p>这里 <code>obj</code> 是新对象的名称,每一个 <code>property_<em>i</em></code> 是一个标识符(可以是一个名称、数字或字符串字面量),并且每个 <code>value_<em>i</em></code> 是一个其值将被赋予 property_<em>i </em>的表达式。<code style="font-style: normal; line-height: 1.5;">obj</code> 与赋值是可选的;如果你不需要在其他地方引用对象,你就不需要将它赋给一个变量。(注意在接受一条语句的地方,你可能需要将对象字面量括在括号里,从而避免将字面量与块语句相混淆)</p> +<p>这里 <code>obj</code> 是新对象的名称,每一个 <code>property_<em>i</em></code> 是一个标识符(可以是一个名称、数字或字符串字面量),并且每个 <code>value_<em>i</em></code> 是一个其值将被赋予 property_<em>i </em>的表达式。<code>obj</code> 与赋值是可选的;如果你不需要在其他地方引用对象,你就不需要将它赋给一个变量。(注意在接受一条语句的地方,你可能需要将对象字面量括在括号里,从而避免将字面量与块语句相混淆)</p> <p>如果一个对象是通过在顶级脚本的对象初始化器创建的,则 JavaScript 在每次遇到包含该对象字面量的表达式时都会创建对象。同样的,在函数中的初始化器在每次函数调用时也会被创建。</p> @@ -285,7 +281,7 @@ fish.displayType(); // Output:Fishes car1.color = "black"; </pre> -<p>参见 <a href="/zh-CN/docs/JavaScript/Reference" style="line-height: 1.5; text-decoration: underline;" title="zh-CN/docs/JavaScript/Reference">JavaScript Reference</a> 中 Function 对象的 <a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/prototype" style="line-height: 1.5;" title="zh-CN/docs/JavaScript/Reference/Global Objects/Function/prototype"><code>prototype</code> 属性</a> 。</p> +<p>参见 <a href="/zh-CN/docs/JavaScript/Reference" title="zh-CN/docs/JavaScript/Reference">JavaScript Reference</a> 中 Function 对象的 <a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/prototype" title="zh-CN/docs/JavaScript/Reference/Global Objects/Function/prototype"><code>prototype</code> 属性</a> 。</p> <h2 id="定义方法">定义方法</h2> @@ -306,7 +302,7 @@ var myObj = { }; </pre> -<p>这里 <code>objectName</code> 是一个已经存在的对象,<code>methodname</code> 是方法的名称,而 <code style="font-style: normal; line-height: 1.5;">function_name</code> 是函数的名称。</p> +<p>这里 <code>objectName</code> 是一个已经存在的对象,<code>methodname</code> 是方法的名称,而 <code>function_name</code> 是函数的名称。</p> <p>你可以在对象的上下文中象这样调用方法:</p> @@ -463,7 +459,7 @@ console.log(o.b) // Runs the getter, which yields a + 1 or 6 <h2 id="删除属性">删除属性</h2> -<p>你可以用 <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/delete">delete</a> 操作符删除一个<strong style="color: red;">不是继承而来</strong>的属性。下面的例子说明如何删除一个属性:</p> +<p>你可以用 <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/delete">delete</a> 操作符删除一个<strong>不是继承而来</strong>的属性。下面的例子说明如何删除一个属性:</p> <pre class="brush: js">//Creates a new object, myobj, with two properties, a and b. var myobj = new Object; |