diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects')
79 files changed, 348 insertions, 396 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/fill/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/fill/index.html index 05f19bfcb5..07c1c104b5 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/fill/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/fill/index.html @@ -42,7 +42,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/fill <p><code><strong>fill</strong></code> 方法故意被设计成通用方法, 该方法不要求 <code>this</code> 是数组对象。</p> -<p><code><strong style="line-height: 1.5;">fill</strong></code> 方法是个可变方法, 它会改变调用它的 <code>this</code> 对象本身, 然后返回它, 而并不是返回一个副本。</p> +<p><code><strong>fill</strong></code> 方法是个可变方法, 它会改变调用它的 <code>this</code> 对象本身, 然后返回它, 而并不是返回一个副本。</p> <p>当一个对象被传递给 <strong><code>fill</code></strong>方法的时候, 填充数组的是这个对象的引用。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/findindex/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/findindex/index.html index b0c8967e8e..ecde3c0f25 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/findindex/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/findindex/index.html @@ -37,7 +37,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/findIndex </dl> </dd> <dt><code>thisArg</code></dt> - <dd>可选。执行<code>callback</code>时作为<code style="font-size: 14px; line-height: inherit;">this</code>对象的值.</dd> + <dd>可选。执行<code>callback</code>时作为<code>this</code>对象的值.</dd> </dl> <h3 id="返回值">返回值</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/map/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/map/index.html index 1517622c81..15e10d0329 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/map/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/map/index.html @@ -334,7 +334,7 @@ if (!Array.prototype.map) { <p>{{Compat("javascript.builtins.Array.map")}}</p> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Array.prototype.forEach()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/of/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/of/index.html index 25e4a88a23..9013ce9446 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/of/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/of/index.html @@ -45,7 +45,7 @@ Array(1, 2, 3); // [1, 2, 3] <h2 id="示例">示例</h2> -<pre class="brush: js" style="font-size: 14px;">Array.of(1); // [1] +<pre class="brush: js">Array.of(1); // [1] Array.of(1, 2, 3); // [1, 2, 3] Array.of(undefined); // [undefined] </pre> @@ -54,7 +54,7 @@ Array.of(undefined); // [undefined] <p>如果原生不支持的话,在其他代码之前执行以下代码会创建 <code>Array.of()</code> 。</p> -<pre class="brush: js" style="font-size: 14px;">if (!Array.of) { +<pre class="brush: js">if (!Array.of) { Array.of = function() { return Array.prototype.slice.call(arguments); }; diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/pop/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/pop/index.html index 51fc625019..3e6caa6795 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/pop/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/pop/index.html @@ -50,7 +50,7 @@ console.log(popped); // surgeon </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/push/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/push/index.html index 3be7c12520..032e985d22 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/push/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/push/index.html @@ -32,11 +32,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/push <dd>被添加到数组末尾的元素。</dd> </dl> -<h3 id="返回值" style="line-height: 24px;">返回值</h3> +<h3 id="返回值">返回值</h3> <p>当调用该方法时,新的 {{jsxref("Array.length", "length")}} 属性值将被返回。</p> -<h2 id="Description" name="Description" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="Description" name="Description">描述</h2> <p>push方法将值追加到数组中。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html index c362c85c77..11e8a7ac85 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html @@ -157,13 +157,6 @@ var maxCallback2 = ( max, cur ) => Math.max( max, cur ); </tbody> </table> -<table style="width: 100%;"> - <tbody> - <tr> - </tr> - </tbody> -</table> - <p>由<code>reduce</code>返回的值将是最后一次回调返回值(10)。</p> <p>你还可以使用{{jsxref("Functions/Arrow_functions", "箭头函数","",1)}}来代替完整的函数。 下面的代码将产生与上面的代码相同的输出:</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html index 1245486db3..793a4fd3a3 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html @@ -118,7 +118,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/ReduceRight <p>一共会调用四次回调函数,每次调用的参数及返回值如下:</p> -<table style="width: 100%;"> +<table> <thead> <tr> <th scope="col"><code>callback</code></th> @@ -174,7 +174,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/ReduceRight }, 10); </pre> -<table style="width: 100%;"> +<table> <thead> <tr> <th scope="col"><code>callback</code></th> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/reverse/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/reverse/index.html index a9c984245f..b408aa046f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/reverse/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/reverse/index.html @@ -20,23 +20,23 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/reverse <div></div> -<h2 id="语法" style="margin-bottom: 20px; line-height: 30px;">语法</h2> +<h2 id="语法">语法</h2> <pre class="syntaxbox"><code><var> arr</var>.reverse()</code></pre> -<h3 id="返回值" style="line-height: 24px;">返回值</h3> +<h3 id="返回值">返回值</h3> <p>颠倒后的数组。</p> -<h2 id="描述" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="描述">描述</h2> <p><code>reverse</code> 方法颠倒数组中元素的位置,改变了数组,并返回该数组的引用。</p> <p>reverse方法是特意类化的;此方法可被 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call" title="The call() method calls a function with a given this value and arguments provided individually.">called</a> 或 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" title="The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).">applied</a>于类似数组对象。对象如果不包含反映一系列连续的、基于零的数值属性中的最后一个长度的属性,则该对象可能不会以任何有意义的方式运行。</p> -<h2 id="示例" style="margin-bottom: 20px; line-height: 30px;">示例</h2> +<h2 id="示例">示例</h2> -<h3 id="颠倒数组中的元素" style="line-height: 24px;">颠倒数组中的元素</h3> +<h3 id="颠倒数组中的元素">颠倒数组中的元素</h3> <p>下例将会创建一个数组 sourceArray,其包含三个元素,然后颠倒该数组。</p> @@ -95,7 +95,7 @@ console.log(a); // {0: 3, 1: 2, 2: 1, length: 3}</code></pre> </tbody> </table> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -122,7 +122,7 @@ console.log(a); // {0: 3, 1: 2, 2: 1, length: 3}</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <div> <div> @@ -132,7 +132,7 @@ console.log(a); // {0: 3, 1: 2, 2: 1, length: 3}</code></pre> </div> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Array.prototype.join()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html index 0aa5dc1186..d62b834d40 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html @@ -201,7 +201,7 @@ var list1 = list(1, 2, 3); // [1, 2, 3] }()); </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -234,7 +234,7 @@ var list1 = list(1, 2, 3); // [1, 2, 3] </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <div> @@ -242,7 +242,7 @@ var list1 = list(1, 2, 3); // [1, 2, 3] <p>{{Compat("javascript.builtins.Array.slice")}}</p> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Array.prototype.splice()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html index c6e408edd2..8c5aabec0f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html @@ -50,7 +50,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/some <p><code>some()</code> 为数组中的每一个元素执行一次 <code>callback</code> 函数,直到找到一个使得 callback 返回一个“真值”(即可转换为布尔值 true 的值)。如果找到了这样一个值,<code>some()</code> 将会立即返回 <code>true</code>。否则,<code>some()</code> 返回 <code>false</code>。<code>callback</code> 只会在那些”有值“的索引上被调用,不会在那些被删除或从来未被赋值的索引上调用。</p> -<p><code style="font-style: normal; line-height: 1.5;">callback</code> 被调用时传入三个参数:元素的值,元素的索引,被遍历的数组。</p> +<p><code>callback</code> 被调用时传入三个参数:元素的值,元素的索引,被遍历的数组。</p> <p>如果一个<code>thisArg</code>参数提供给some(),它将被用作调用的 <code>callback</code>的 <code>this</code> 值。否则, 它的 <code>this</code> value将是 <code>undefined</code>。<code>this</code>的值最终通过callback来观察,根据 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/this">the usual rules for determining the <code>this</code> seen by a function</a>的this判定规则来确定。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html index 7b92b97033..566ba9e61e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html @@ -57,7 +57,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt64Array <dd> <div class="trans-left"> <div class="trans-input-wrap"> - <div class="input-wrap" dir="ltr" style="height: auto;">用静态值填充从起始索引到结束索引的数组的所有元素。另请参见{jsxref(“Array.prototype.fill()")}}</div> + <div class="input-wrap" dir="ltr">用静态值填充从起始索引到结束索引的数组的所有元素。另请参见{jsxref(“Array.prototype.fill()")}}</div> </div> </div> </dd> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html index 4bbfc8ad23..5f7d438415 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getDate()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getDate()</code></pre> <h2 id="Parameters" name="Parameters">参数</h2> @@ -27,14 +27,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate <h3 id="Example:_Using_getDate" name="Example:_Using_getDate">例子: 使用getDate()<code>方法</code></h3> -<p>下面第二条语句将值25赋给 day 变量,该值基于日期对象 <code style="font-style: normal; line-height: 1.5;">Xmax95</code>的值。</p> +<p>下面第二条语句将值25赋给 day 变量,该值基于日期对象 <code>Xmax95</code>的值。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:00"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:00"); var day = Xmas95.getDate(); alert(day); // 25</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -63,11 +63,11 @@ alert(day); // 25</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getDate")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCDate()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html index e9b18b852e..b2ee4a80cd 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;"><em>dateObj</em>.getDay()</code> +<pre class="syntaxbox language-html"><code class="language-html"><em>dateObj</em>.getDay()</code> </pre> <h3 id="Description" name="Description">返回值</h3> @@ -26,7 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay <p>下面第二条语句,基于{{jsxref("Date")}}对象 <code>Xmas95</code> 的值,把 1 赋值给 <code>weekday</code>。也就是说1995年12月25日是星期一。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:30"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:30"); var weekday = Xmas95.getDay(); console.log(weekday); // 1</code></pre> @@ -41,7 +41,7 @@ console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95)); // Montag</code></pre> </div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -73,11 +73,11 @@ console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95)); </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getDay")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCDate()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html index 7c4cf29b9a..6b8638c52d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getfullyear/index.html @@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getFullYear <h2 id="Syntax" name="Syntax">语法</h2> -<pre style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getFullYear()</code> +<pre><code class="language-html">dateObj.getFullYear()</code> </pre> <h3 id="Description" name="Description">返回值</h3> @@ -42,7 +42,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getFullYear var year = today.getFullYear(); </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -74,11 +74,11 @@ var year = today.getFullYear(); </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getFullYear")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCFullYear()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html index eb8ad854e1..fda9396354 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours <h2 id="语法">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><var>dateObj</var>.getHours()</pre> +<pre class="syntaxbox language-html"><var>dateObj</var>.getHours()</pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -29,12 +29,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours <p>下面第二条语句,基于日期对象 <code>Xmas95 </code>的值,把 23 赋值给了变量 <code>hours。</code></p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:00"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:00"); var hours = Xmas95.getHours(); alert(hours); // 23</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -61,11 +61,11 @@ alert(hours); // 23</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getHours")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCHours()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html index be3ebe8f9b..c5dd09e3d9 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><var>dateObj</var>.getMilliseconds()</pre> +<pre class="syntaxbox language-html"><var>dateObj</var>.getMilliseconds()</pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -29,11 +29,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds <p>下例中,将当前时间的毫秒数赋值给变量 <code>ms</code>。</p> -<pre class="brush: js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var ms; +<pre class="brush: js language-js"><code class="language-js">var ms; Today = new Date(); ms = Today.getMilliseconds();</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -60,11 +60,11 @@ ms = Today.getMilliseconds();</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getMilliseconds")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCMilliseconds()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html index 7a1fd0f433..8322a9e813 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getMinutes()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getMinutes()</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -27,10 +27,10 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes <p>下例中,第二行语句运行过后,变量 <code>minutes </code>的值为15,也就是说 <code>Xmas95 </code>这个日期对象的值为某时15分某秒。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:00"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:00"); var minutes = Xmas95.getMinutes();</code></pre> -<p dir="ltr"><strong style="font-size: 2.142857142857143rem; font-weight: 700; letter-spacing: -1px; line-height: 30px;">规范</strong></p> +<p dir="ltr"><strong>规范</strong></p> <table class="standard-table"> <tbody> @@ -57,13 +57,13 @@ var minutes = Xmas95.getMinutes();</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p> </p> <p>{{Compat("javascript.builtins.Date.getMinutes")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCMinutes()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html index 0002ecf4a1..63a953f263 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html @@ -79,7 +79,7 @@ console.log(month); // 11</pre> <p>{{Compat("javascript.builtins.Date.getMonth")}}</p> </div> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCMonth()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html index 457f166047..ded6203208 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getSeconds()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getSeconds()</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -29,14 +29,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds <p>下面第二条语句,基于日期对象 <code>Xmas95</code> 的值,把 30 赋值给变量 <code>secs</code>。</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var Xmas95 = new Date("December 25, 1995 23:15:30"); +<pre class="brush:js language-js"><code class="language-js">var Xmas95 = new Date("December 25, 1995 23:15:30"); var secs = Xmas95.getSeconds();</code></pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: transparent;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: transparent;"> </div> +<div class="line-number"> </div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -63,11 +63,11 @@ var secs = Xmas95.getSeconds();</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Date.getSeconds")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Date.prototype.getUTCSeconds()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html index 87b619c759..7ee056a7df 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.getTimezoneOffset()</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.getTimezoneOffset()</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/index.html index 2c8e41406b..764d868453 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/index.html @@ -45,7 +45,7 @@ new Date(<var>year</var>, <var>monthIndex</var> [, <var>day</var> [, <var>hours< <h4 id="时间戳字符串">时间戳字符串</h4> </dt> <dt><code>dateString</code></dt> - <dd>表示日期的字符串值。该字符串应该能被 {{jsxref("Date.parse()")}} 正确方法识别(即符合 <a href="http://tools.ietf.org/html/rfc2822#page-14" style="white-space: pre-line;">IETF-compliant RFC 2822 timestamps</a> 或 <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15">version of ISO8601</a>)。 + <dd>表示日期的字符串值。该字符串应该能被 {{jsxref("Date.parse()")}} 正确方法识别(即符合 <a href="http://tools.ietf.org/html/rfc2822#page-14">IETF-compliant RFC 2822 timestamps</a> 或 <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15">version of ISO8601</a>)。 <div class="note"> <p><strong>注意:</strong> 由于浏览器之间的差异与不一致性,强烈不推荐使用<code>Date</code>构造函数来解析日期字符串 (或使用与其等价的<code>Date.parse</code>)。对 RFC 2822 格式的日期仅有约定俗成的支持。 对 ISO 8601 格式的支持中,仅有日期的串 (例如 "1970-01-01") 会被处理为 UTC 而不是本地时间,与其他格式的串的处理不同。</p> </div> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html index ad8ffc0c33..c8fcb530ab 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear <h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr;">dateObj.setFullYear(yearValue[, monthValue[, dayValue]])</code></pre> +<pre class="syntaxbox language-html"><code class="language-html">dateObj.setFullYear(yearValue[, monthValue[, dayValue]])</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -36,7 +36,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear <h3 id="Example:_Using_setFullYear" name="Example:_Using_setFullYear">例子:使用<code>setFullYear</code>方法</h3> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; text-shadow: none; direction: ltr; white-space: normal; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; color: inherit; text-shadow: none; direction: ltr; white-space: pre;">var theBigDay = new Date(); +<pre class="brush:js language-js"><code class="language-js">var theBigDay = new Date(); theBigDay.setFullYear(1997);</code></pre> <h2 id="规范">规范</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html index e351f33c33..a5b2885180 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/tolocalestring/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleString --- <div>{{JSRef("Global_Objects", "Date")}}</div> -<p><code><strong>toLocaleString()</strong></code> 方法返回该日期对象的字符串,该字符串格式因不同语言而不同。新增的参数 <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> +<p><code><strong>toLocaleString()</strong></code> 方法返回该日期对象的字符串,该字符串格式因不同语言而不同。新增的参数 <code>locales</code> 和 <code>options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code>locales</code> 和 <code>options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> <div>{{EmbedInteractiveExample("pages/js/date-tolocalestring.html")}}</div> @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleString <h3 id="Parameters" name="Parameters">参数</h3> -<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> +<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code>locales</code> 和 <code>options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> <p>{{page('zh-CN/docs/JavaScript/Reference/Global_Objects/DateTimeFormat','Parameters')}}</p> @@ -42,7 +42,7 @@ date.toLocaleString(); <h3 id="Example:_Checking_for_support_for_locales_and_options_arguments" name="Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</h3> -<p><code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code style="font-style: normal;">RangeError</code> 异常,反之会忽略参数。</p> +<p><code>locales</code> 和 <code>options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code>RangeError</code> 异常,反之会忽略参数。</p> <pre class="brush: js">function toLocaleStringSupportsLocales() { try { @@ -56,7 +56,7 @@ date.toLocaleString(); <h3 id="Example:_Using_locales" name="Example:_Using_locales">例子:使用 <code>locales</code> 参数</h3> -<p>下例展示了本地化日期格式的一些变化。为了在应用的用户界面得到某种语言的日期和时间格式,必须确保使用 <code style="font-style: normal;">locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> +<p>下例展示了本地化日期格式的一些变化。为了在应用的用户界面得到某种语言的日期和时间格式,必须确保使用 <code>locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); @@ -90,7 +90,7 @@ alert(date.toLocaleString(["ban", "id"])); <h3 id="Example:_Using_options" name="Example:_Using_options">例子:使用 <code>options</code> 参数</h3> -<p>可以使用 <code style="font-style: normal;">options </code>参数来自定义 <code style="font-style: normal;">toLocaleString</code> 方法返回的字符串。</p> +<p>可以使用 <code>options </code>参数来自定义 <code>toLocaleString</code> 方法返回的字符串。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html index 2f31d53e2d..cf32bed733 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaletimestring/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString --- <div>{{JSRef("Global_Objects", "Date")}}</div> -<p>The <code><strong>toLocaleTimeString()</strong></code> 方法返回该日期对象时间部分的字符串,该字符串格式因不同语言而不同。新增的参数 <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code style="font-style: normal; line-height: 1.5;">locales</code> 和 <code style="font-style: normal; line-height: 1.5;">options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> +<p>The <code><strong>toLocaleTimeString()</strong></code> 方法返回该日期对象时间部分的字符串,该字符串格式因不同语言而不同。新增的参数 <code>locales</code> 和 <code>options</code> 使程序能够指定使用哪种语言格式化规则,允许定制该方法的表现(behavior)。在旧版本浏览器中, <code>locales</code> 和 <code>options</code> 参数被忽略,使用的语言环境和返回的字符串格式是各自独立实现的。</p> <div>{{EmbedInteractiveExample("pages/js/date-tolocaletimestring.html")}}</div> @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString <h3 id="Parameters" name="Parameters">参数</h3> -<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> +<p>查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code>locales</code> 和 <code>options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p> <p>{{page('zh-US/docs/JavaScript/Reference/Global_Objects/DateTimeFormat','Parameters')}}</p> @@ -38,7 +38,7 @@ alert(date.toLocaleTimeString()); <h3 id="Example:_Checking_for_support_for_locales_and_options_arguments" name="Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 支持情况</h3> -<p><code style="font-style: normal;">locales</code> 和 <code style="font-style: normal;">options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code style="font-style: normal;">RangeError</code> 异常,反之会忽略参数。</p> +<p><code>locales</code> 和 <code>options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code>RangeError</code> 异常,反之会忽略参数。</p> <pre class="brush: js">function toLocaleTimeStringSupportsLocales() { try { @@ -52,7 +52,7 @@ alert(date.toLocaleTimeString()); <h3 id="Example:_Using_locales" name="Example:_Using_locales">例子:使用 <code>locales</code> 参数</h3> -<p>下例展示了本地化时间格式的一些变化。为了在应用的用户界面得到某种语言的时间格式,必须确保使用 <code style="font-style: normal;">locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> +<p>下例展示了本地化时间格式的一些变化。为了在应用的用户界面得到某种语言的时间格式,必须确保使用 <code>locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); @@ -83,7 +83,7 @@ alert(date.toLocaleTimeString(["ban", "id"])); <h3 id="Example:_Using_options" name="Example:_Using_options">例子:使用 <code>options</code> 参数</h3> -<p>可以使用 <code style="font-style: normal;">options </code>参数来自定义 <code style="font-style: normal;">toLocaleTimeString</code> 方法返回的字符串。</p> +<p>可以使用 <code>options </code>参数来自定义 <code>toLocaleTimeString</code> 方法返回的字符串。</p> <pre class="brush: js">var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html index b99486c6b6..faa183e9cf 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/totimestring/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toTimeString <p>{{jsxref("Global_Objects/Date", "Date")}} 对象的实例引用一个具体的时间点。 调用 {{jsxref("Date.toString", "toString")}} 方法以美式英语和人类易读的形式,返回日期对象的格式化字符串。在 <a href="/en-US/docs/SpiderMonkey" title="SpiderMonkey">SpiderMonkey</a> 里,该字符串由日期部分(年月日)和其后的时间部分(时分秒和时区)组成。有时会需要获取时间部分的字符串,这可以由 <code>toTimeString</code> 方法完成。</p> -<p>The <code style="font-style: normal;">toTimeString</code> method is especially useful because compliant engines implementing <a href="https://developer.mozilla.org/en-US/docs/ECMAScript" title="ECMAScript">ECMA-262</a> may differ in the string obtained from <code style="font-style: normal;">toString</code> for <code style="font-style: normal;">Date</code> objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines.</p> +<p>The <code>toTimeString</code> method is especially useful because compliant engines implementing <a href="https://developer.mozilla.org/en-US/docs/ECMAScript" title="ECMAScript">ECMA-262</a> may differ in the string obtained from <code>toString</code> for <code>Date</code> objects, as the format is implementation-dependent; simple string slicing approaches may not produce consistent results across multiple engines.</p> <h2 id="Example" name="Example">例子</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/index.html index b9334c7969..fe9ad2deed 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/index.html @@ -49,37 +49,37 @@ const y = new Error('I was constructed via the "new" keyword!');</code></pre> <h3 id="Error_types" name="Error_types">Error 类型</h3> -<p>除了通用的Error构造函数外,JavaScript还有6个其他类型的错误构造函数。更多客户端异常,详见 <a href="/en/JavaScript/Guide/Statements#Exception_Handling_Statements" style="line-height: inherit;" title="en/JavaScript/Guide/Statements#Exception Handling Statements">Exception Handling Statements</a>。</p> +<p>除了通用的Error构造函数外,JavaScript还有6个其他类型的错误构造函数。更多客户端异常,详见 <a href="/en/JavaScript/Guide/Statements#Exception_Handling_Statements" title="en/JavaScript/Guide/Statements#Exception Handling Statements">Exception Handling Statements</a>。</p> <dl> - <dt><strong style="font-weight: bold;">{{jsxref("EvalError")}}</strong></dt> + <dt><strong>{{jsxref("EvalError")}}</strong></dt> <dd>创建一个error实例,表示错误的原因:与 {{jsxref("Global_Objects/eval", "eval()")}} 有关。</dd> - <dt><strong style="font-weight: bold;">{{jsxref("InternalError")}} {{non-standard_inline}}</strong></dt> + <dt><strong>{{jsxref("InternalError")}} {{non-standard_inline}}</strong></dt> <dd>创建一个代表Javascript引擎内部错误的异常抛出的实例。 如: "递归太多".</dd> </dl> <dl> - <dt><strong style="font-weight: bold;">{{jsxref("RangeError", "RangeError")}}</strong></dt> + <dt><strong>{{jsxref("RangeError", "RangeError")}}</strong></dt> <dd>创建一个error实例,表示错误的原因:数值变量或参数超出其有效范围。</dd> </dl> <dl> - <dt><strong style="font-weight: bold;">{{jsxref("ReferenceError")}}</strong></dt> + <dt><strong>{{jsxref("ReferenceError")}}</strong></dt> <dd>创建一个error实例,表示错误的原因:无效引用。</dd> </dl> <dl> - <dt><strong style="font-weight: bold;">{{jsxref("SyntaxError")}}</strong></dt> + <dt><strong>{{jsxref("SyntaxError")}}</strong></dt> <dd>创建一个error实例,表示错误的原因:{{jsxref("Global_Objects/eval", "eval()")}}在解析代码的过程中发生的语法错误。</dd> </dl> <dl> - <dt><strong style="font-weight: bold;">{{jsxref("TypeError")}}</strong></dt> + <dt><strong>{{jsxref("TypeError")}}</strong></dt> <dd>创建一个error实例,表示错误的原因:变量或参数不属于有效类型。</dd> </dl> <dl> - <dt><strong style="font-weight: bold;">{{jsxref("URIError")}}</strong></dt> + <dt><strong>{{jsxref("URIError")}}</strong></dt> <dd>创建一个error实例,表示错误的原因:给 {{jsxref("Global_Objects/encodeURI", "encodeURI()")}}或 {{jsxref("Global_Objects/decodeURI", "decodeURI()")}}传递的参数无效。</dd> </dl> @@ -141,7 +141,7 @@ const y = new Error('I was constructed via the "new" keyword!');</code></pre> <p>你可能希望自定义基于Error的异常类型,使得你能够 throw new MyError() 并可以使用 <code>instanceof MyError</code> 来检查某个异常的类型. 这种需求的通用解决方法如下.</p> -<div class="warning" style="font-size: 14px;"> +<div class="warning"> <p>注意,在FireFox中抛出自定义类型的异常会显示不正确的行号和文件名。</p> </div> @@ -170,49 +170,49 @@ try { console.log(e.message); // 'custom message' }</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 38px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 57px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 76px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 95px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 114px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 133px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 152px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 171px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 190px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 209px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 228px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 247px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 266px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 285px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 304px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 323px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 342px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 361px; background: 0px 0px;"></div> +<div class="line-number"></div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 380px; background: 0px 0px;"></div> +<div class="line-number"></div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -244,11 +244,11 @@ try { </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <div>{{Compat("javascript.builtins.Error")}}</div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Error.prototype")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html index 4d24a6f972..0903c6e059 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html @@ -7,7 +7,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Error/name <h2 id="Summary" name="Summary">概述</h2> -<p><code style="font-style: normal; line-height: 19.0909080505371px;"><strong>name</strong></code> 属性表示error类型的名称.初始值为"Error".</p> +<p><code><strong>name</strong></code> 属性表示error类型的名称.初始值为"Error".</p> <h2 id="Description" name="Description">描述</h2> @@ -23,9 +23,9 @@ e.name = "ParseError"; // 修改之后,e.toString()会成为下 throw e; // "ParseError: Malformed input" </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">规范</h2> +<h2 id="规范">规范</h2> -<table class="standard-table" style="line-height: 19.0909080505371px;"> +<table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> @@ -50,20 +50,20 @@ throw e; // "ParseError: Malformed input" </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> -<div style="line-height: 19.0909080505371px;">{{CompatibilityTable}}</div> +<div>{{CompatibilityTable}}</div> -<div style="line-height: 19.0909080505371px;"> -<table class="compat-table" style="border-color: transparent;"> +<div> +<table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> </tr> <tr> <td>Basic support</td> @@ -77,17 +77,17 @@ throw e; // "ParseError: Malformed input" </table> </div> -<div style="line-height: 19.0909080505371px;"> -<table class="compat-table" style="border-color: transparent;"> +<div> +<table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Chrome for Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Mobile</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -102,9 +102,9 @@ throw e; // "ParseError: Malformed input" </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> -<ul style="line-height: 19.0909080505371px;"> +<ul> <li>{{jsxref("Error.prototype.message")}}</li> <li>{{jsxref("Error.prototype.toString()")}}</li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/stack/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/stack/index.html index 0406826e77..53daa6aba0 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/stack/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/stack/index.html @@ -100,7 +100,7 @@ try { // @file:///C:/example.html:7:6 </pre> -<p>你也可以使用<code>//# sourceURL</code> 命名eval源的指令。 也可以查看在 <a href="/en-US/docs/Tools/Debugger">Debugger</a>文档中的<a href="/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources" style="">Debug eval 源</a>和<a href="http://fitzgeraldnick.com/weblog/59/">blog post博客 。</a></p> +<p>你也可以使用<code>//# sourceURL</code> 命名eval源的指令。 也可以查看在 <a href="/en-US/docs/Tools/Debugger">Debugger</a>文档中的<a href="/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources">Debug eval 源</a>和<a href="http://fitzgeraldnick.com/weblog/59/">blog post博客 。</a></p> <h2 id="规范">规范</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html index 944791e29c..89706614c4 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html @@ -38,7 +38,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply <p>在调用一个存在的函数时,你可以为其指定一个 <code>this</code> 对象。 <code>this</code> 指当前对象,也就是正在调用这个函数的对象。 使用 <code>apply</code>, 你可以只写一次这个方法然后在另一个对象中继承它,而不用在新对象中重复写该方法。</p> -<p><code>apply</code> 与 {{jsxref("Function.call", "call()")}} 非常相似,不同之处在于提供参数的方式。<code style="font-size: 14px;">apply</code> 使用参数数组而不是一组参数列表。<code>apply</code> 可以使用数组字面量(array literal),如 <code>fun.apply(this, ['eat', 'bananas'])</code>,或数组对象, 如 <code>fun.apply(this, new Array('eat', 'bananas'))</code>。</p> +<p><code>apply</code> 与 {{jsxref("Function.call", "call()")}} 非常相似,不同之处在于提供参数的方式。<code>apply</code> 使用参数数组而不是一组参数列表。<code>apply</code> 可以使用数组字面量(array literal),如 <code>fun.apply(this, ['eat', 'bananas'])</code>,或数组对象, 如 <code>fun.apply(this, new Array('eat', 'bananas'))</code>。</p> <p>你也可以使用 {{jsxref("Functions/arguments", "arguments")}}对象作为 <code>argsArray</code> 参数。 <code>arguments</code> 是一个函数的局部变量。 它可以被用作被调用对象的所有未指定的参数。 这样,你在使用apply函数的时候就不需要知道被调用对象的所有参数。 你可以使用arguments来把所有的参数传递给被调用对象。 被调用对象接下来就负责处理这些参数。</p> @@ -131,7 +131,7 @@ var min = minOfArray([5, 6, 2, 3, 7]); <p>使用闭包:</p> -<pre class="brush: js" style="font-style: normal;">Function.prototype.construct = function(aArgs) { +<pre class="brush: js">Function.prototype.construct = function(aArgs) { var fConstructor = this, fNewConstr = function() { fConstructor.apply(this, aArgs); }; @@ -139,7 +139,7 @@ var min = minOfArray([5, 6, 2, 3, 7]); return new fNewConstr(); };</pre> -<p class="brush: js" style="font-style: normal;">使用 Function 构造器:</p> +<p class="brush: js">使用 Function 构造器:</p> <pre class="brush: js">Function.prototype.construct = function (aArgs) { var fNewConstr = new Function(""); @@ -168,7 +168,7 @@ console.log(myInstance.constructor); // logs "MyConstructor" <div class="note"><strong>注意:</strong> 这个非native的<code>Function.construct</code>方法无法和一些native构造器(例如<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Date" title="JavaScript/Reference/Global_Objects/Date"><code>Date</code></a>)一起使用。 在这种情况下你必须使用<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors" title="JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors"><code>Function.bind</code></a>方法(例如,想象有如下一个数组要用在Date构造器中: <code>[2012, 11, 4]</code>;这时你需要这样写: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> – -无论如何这不是最好的实现方式并且也许不该用在任何生产环境中).</div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -200,11 +200,11 @@ console.log(myInstance.constructor); // logs "MyConstructor" </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.Function.apply")}}</p> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Functions_and_function_scope/arguments", "arguments ")}} object</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html index 8940da5ad4..45ee18de46 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html @@ -212,7 +212,7 @@ var slice = Function.prototype.apply.bind(unboundSlice); slice(arguments);</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html index 5b9fc87b48..5962c181a0 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html @@ -101,7 +101,7 @@ var obj = { greet.call(obj); // cats typically sleep between 12 and 16 hours </pre> -<h3 id="使用_call_方法调用函数并且不指定第一个参数(argument)" style="margin-bottom: 20px; line-height: 30px;">使用 <code><strong>call</strong></code> 方法调用函数并且不指定第一个参数(<code>argument</code>)</h3> +<h3 id="使用_call_方法调用函数并且不指定第一个参数(argument)">使用 <code><strong>call</strong></code> 方法调用函数并且不指定第一个参数(<code>argument</code>)</h3> <p>在下面的例子中,我们调用了 <code>display</code> 方法,但并没有传递它的第一个参数。如果没有传递第一个参数,<code>this</code> 的值将会被绑定为全局对象。</p> @@ -127,7 +127,7 @@ function display() { display.call(); // Cannot read the property of 'sData' of undefined</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -165,7 +165,7 @@ display.call(); // Cannot read the property of 'sData' of undefined</pre> <p>{{Compat("javascript.builtins.Function.call")}}</p> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Function.prototype.bind()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html index 61f96599b8..0f7695c49e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html @@ -46,7 +46,7 @@ var object = { console.log(f.name); // "f" console.log(object.someMethod.name); // "someMethod"</pre> -<p style="color: rgb(77, 78, 83);">你可以在 {{jsxref("Operators/Function", "函数表达式", "", 1)}}中定义函数的名称:</p> +<p>你可以在 {{jsxref("Operators/Function", "函数表达式", "", 1)}}中定义函数的名称:</p> <pre class="brush:js">var object = { someMethod: function object_someMethod() {} diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html index 01bf4d2ce7..1ab33a0d1f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html @@ -176,7 +176,7 @@ Function("a", "b")</pre> </tbody> </table> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/generator/index.html b/files/zh-cn/web/javascript/reference/global_objects/generator/index.html index f7e4fc037b..9efc414db4 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/generator/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/generator/index.html @@ -59,7 +59,7 @@ console.log(gen.next().value); <h2 id="传统的生成器对象">传统的生成器对象</h2> -<p>Firefox (SpiderMonkey) 在 <a href="/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7">JavaScript 1.7</a> 中也实现了一个较早版本的生成器,其中函数声明中的星号(*)不是必需的 (只需在函数体中使用<code style="font-style: normal;">yield</code> 关键字)。但是,旧式生成器已弃用。不要使用它们;他们将被删除 ({{bug(1083482)}})。</p> +<p>Firefox (SpiderMonkey) 在 <a href="/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7">JavaScript 1.7</a> 中也实现了一个较早版本的生成器,其中函数声明中的星号(*)不是必需的 (只需在函数体中使用<code>yield</code> 关键字)。但是,旧式生成器已弃用。不要使用它们;他们将被删除 ({{bug(1083482)}})。</p> <h3 id="传统的生成器方法">传统的生成器方法</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/isfinite/index.html b/files/zh-cn/web/javascript/reference/global_objects/isfinite/index.html index 296dcf5bc0..e69904ba41 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/isfinite/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/isfinite/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/isFinite <h2 id="语法">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; direction: ltr; white-space: normal; text-shadow: none; background-color: rgba(212, 221, 228, 0.498039);">isFinite(<em>testValue</em>)</pre> +<pre class="syntaxbox language-html">isFinite(<em>testValue</em>)</pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -31,9 +31,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/isFinite <p>你可以用这个方法来判定一个数字是否是有限数字。<code>isFinite</code> 方法检测它参数的数值。如果参数是 <code>NaN</code>,正无穷大或者负无穷大,会返回<code>false</code>,其他返回 <code>true</code>。</p> -<h2 id="Examples" name="Examples" style="margin-bottom: 20px; line-height: 30px;">示例</h2> +<h2 id="Examples" name="Examples">示例</h2> -<pre class="brush: js language-js" style="padding: 1em 0px 1em 30px; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; direction: ltr; white-space: normal; text-shadow: none; background-color: rgba(234, 239, 242, 0.247059);"><code class="language-js" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; direction: ltr; white-space: pre; color: inherit; text-shadow: none;">isFinite(Infinity); // false +<pre class="brush: js language-js"><code class="language-js">isFinite(Infinity); // false isFinite(NaN); // false isFinite(-Infinity); // false @@ -43,25 +43,25 @@ isFinite(2e64); // true, 在更强壮的Number.isFinite(null)中将会得 isFinite("0"); // true, 在更强壮的Number.isFinite('0')中将会得到false</code></pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 38px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 57px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 76px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 95px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 114px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 133px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 152px; background: 0px 0px;"> </div> +<div class="line-number"> </div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -93,11 +93,11 @@ isFinite("0"); // true, 在更强壮的Number.isFinite('0')中将会得到 </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.isFinite")}}</p> -<h2 id="See_Also" name="See_Also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_Also" name="See_Also">相关链接</h2> <ul> <li>{{jsxref("Number.isFinite()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/json/index.html b/files/zh-cn/web/javascript/reference/global_objects/json/index.html index 9eb0663504..cbacf78288 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/json/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/json/index.html @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/JSON <h3 id="JavaScript_Object_Notation" name="JavaScript_Object_Notation">JavaScript Object Notation</h3> -<p><strong>JSON</strong> 是一种语法,用来序列化对象、数组、数值、字符串、布尔值和 {{jsxref("null")}} 。它基于 JavaScript 语法,但与之不同:<strong>JavaScript不是JSON,JSON也不是JavaScript</strong>。参考 <a href="http://timelessrepo.com/json-isnt-a-javascript-subset" style="line-height: 1.5; text-decoration: underline;">JSON:并不是JavaScript 的子集</a>。</p> +<p><strong>JSON</strong> 是一种语法,用来序列化对象、数组、数值、字符串、布尔值和 {{jsxref("null")}} 。它基于 JavaScript 语法,但与之不同:<strong>JavaScript不是JSON,JSON也不是JavaScript</strong>。参考 <a href="http://timelessrepo.com/json-isnt-a-javascript-subset">JSON:并不是JavaScript 的子集</a>。</p> <table> <caption>JavaScript 与 JSON 的区别</caption> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html index bd41c06b44..6112c6e45e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html @@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/clz32 <dd>一个数字.</dd> </dl> -<h2 id="描述" style="line-height: 30px;">描述</h2> +<h2 id="描述">描述</h2> <p>"clz32" 是 CountLeadingZeroes32 的缩写.</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html index 3098a43b63..ff321fb664 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/expm1 <h2 id="Description" name="Description">描述</h2> -<p><code>参数 <code style="font-size: 14px; line-height: inherit; margin: 0px; padding: 0px; border: 0px; color: rgb(77, 78, 83);">x</code> 会被自动类型转换成 <code style="font-size: 14px; line-height: inherit; margin: 0px; padding: 0px; border: 0px; color: rgb(77, 78, 83);">number </code>类型.</code></p> +<p><code>参数 <code>x</code> 会被自动类型转换成 <code>number </code>类型.</code></p> <p><code>expm1 是 "exponent minus 1" 的缩写.</code></p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/log/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/log/index.html index 827dea60af..5be95016a8 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/log/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/log/index.html @@ -26,7 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/log <p>如果指定的 <code>number</code> 为负数,则返回值为 <code>NaN</code>。</p> -<p>由于 <code style="font-style: normal;">log</code> 是 <code style="font-style: normal;">Math</code> 的静态方法,所以应该像这样使用:<code style="font-style: normal;">Math.log()</code>,而不是作为你创建的 <code style="font-style: normal;">Math</code> 对象的方法。</p> +<p>由于 <code>log</code> 是 <code>Math</code> 的静态方法,所以应该像这样使用:<code>Math.log()</code>,而不是作为你创建的 <code>Math</code> 对象的方法。</p> <h2 id="示例">示例</h2> @@ -49,7 +49,7 @@ Math.log(10); // 2.302585092994046</pre> <p>如果你运行 <code>getBaseLog(10, 1000),则会返回</code><code>2.9999999999999996,非常接近实际答案:3,原因是浮点数精度问题。</code></p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -76,7 +76,7 @@ Math.log(10); // 2.302585092994046</pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{ CompatibilityTable() }}</p> @@ -84,12 +84,12 @@ Math.log(10); // 2.302585092994046</pre> <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> </tr> <tr> <td>Basic support</td> @@ -107,13 +107,13 @@ Math.log(10); // 2.302585092994046</pre> <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Chrome for Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Mobile</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -128,7 +128,7 @@ Math.log(10); // 2.302585092994046</pre> </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <p></p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/log1p/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/log1p/index.html index 403d4039a2..e80f580580 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/log1p/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/log1p/index.html @@ -28,9 +28,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/log1p <p><code>函数 y = log(x+1) 的图形是这样的:</code></p> -<p> <img alt="log(x+1)" src="https://mdn.mozillademos.org/files/6467/logx1.jpg" style="height: 300px; width: 400px;"></p> +<p> <img alt="log(x+1)" src="https://mdn.mozillademos.org/files/6467/logx1.jpg"></p> -<p><strong style="font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 30px;">示例</strong></p> +<p><strong>示例</strong></p> <pre class="brush:js">Math.log1p(Math.E-1) // 1 Math.log1p(0) // 0 diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html index 9c844c1447..fcfc82fbd5 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html @@ -23,7 +23,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI <p>下面的函数使用 Math.PI 计算给定半径的圆周长:</p> -<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; font-size: 14px; white-space: normal; color: rgb(77, 78, 83);"><code class="language-js" style="direction: ltr; white-space: pre;">function calculateCircumference (radius) { +<pre class="brush:js language-js"><code class="language-js">function calculateCircumference (radius) { return 2 * Math.PI * radius; } diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html index 3ede0647ac..9138f6d635 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/pow --- <div>{{JSRef}}</div> -<p><code><strong>Math.pow()</strong></code> 函数返回基数(<code>base</code>)的指数(<code>exponent</code>)次幂,即 <code style="font-size: 14px;">base<sup>exponent</sup></code>。</p> +<p><code><strong>Math.pow()</strong></code> 函数返回基数(<code>base</code>)的指数(<code>exponent</code>)次幂,即 <code>base<sup>exponent</sup></code>。</p> <p>{{EmbedInteractiveExample("pages/js/math-pow.html")}}</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/round/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/round/index.html index 6b9b7956ba..409b9dbaa1 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/round/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/round/index.html @@ -40,7 +40,7 @@ x = Math.round(-20.5); //-20 x = Math.round(-20.51); //-21 </pre> -<h3 id="Example:_Decimal_rounding" name="Example:_Decimal_rounding" style="line-height: 24px;">小数舍入</h3> +<h3 id="Example:_Decimal_rounding" name="Example:_Decimal_rounding">小数舍入</h3> <pre class="brush: js">// 闭包 (function(){ @@ -126,7 +126,7 @@ Math.ceil10(-59, 1); // -50 round(1.005, 2); //1.01 </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -153,7 +153,7 @@ round(1.005, 2); //1.01 </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <div>{{CompatibilityTable}}</div> @@ -161,12 +161,12 @@ round(1.005, 2); //1.01 <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari (WebKit)</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> @@ -184,12 +184,12 @@ round(1.005, 2); //1.01 <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Phone</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -203,7 +203,7 @@ round(1.005, 2); //1.01 </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <p></p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/sqrt2/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/sqrt2/index.html index 5171a2f9df..8eb81b8572 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/sqrt2/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/sqrt2/index.html @@ -16,7 +16,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/SQRT2 } getRoot2(); // 1.4142135623730951</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> <tr> @@ -41,18 +41,18 @@ getRoot2(); // 1.4142135623730951</pre> </tr> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{ CompatibilityTable() }}</p> <div> <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> </tr> <tr> <td>Basic support</td> @@ -69,13 +69,13 @@ getRoot2(); // 1.4142135623730951</pre> <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Chrome for Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Mobile</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -89,7 +89,7 @@ getRoot2(); // 1.4142135623730951</pre> </tbody> </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>The {{jsxref("Global_Objects/Math", "Math")}} object it belongs to.</li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/trunc/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/trunc/index.html index f260b85c58..485a96e75d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/trunc/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/trunc/index.html @@ -105,7 +105,7 @@ Math.trunc() // NaN</pre> <p>{{Compat("javascript.builtins.Math.trunc")}}</p> -<p><strong style="color: #4d4e53; font-size: 2.14286rem; font-weight: 700; letter-spacing: -1px;">相关链接</strong></p> +<p><strong>相关链接</strong></p> <ul> <li>{{jsxref("Math.abs()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/nan/index.html b/files/zh-cn/web/javascript/reference/global_objects/nan/index.html index c83a017f48..95eda30e2e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/nan/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/nan/index.html @@ -40,7 +40,7 @@ valueIsNaN(Number.NaN); // true</pre> <pre><code>isNaN('hello world'); // true Number.isNaN('hello world'); // false</code></pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <thead> @@ -55,11 +55,11 @@ Number.isNaN('hello world'); // false</code></pre> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.builtins.NaN")}}</p> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Number.NaN")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/number/nan/index.html b/files/zh-cn/web/javascript/reference/global_objects/number/nan/index.html index e75b557e76..e7df054c6f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/number/nan/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/number/nan/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN --- <div>{{JSRef("Global_Objects", "Number")}}</div> -<h2 id="Summary" name="Summary" style="margin-bottom: 20px; line-height: 30px;">概述</h2> +<h2 id="Summary" name="Summary">概述</h2> <p><code><strong>Number.NaN</strong></code> 表示“非数字”(Not-A-Number)。和 {{jsxref("Global_Objects/NaN", "NaN")}} 相同。</p> @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN <p>{{js_property_attributes(0,0,0)}}</p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -45,7 +45,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{ CompatibilityTable() }}</p> @@ -53,12 +53,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> </tr> <tr> <td>Basic support</td> @@ -76,13 +76,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Chrome for Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Mobile</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -97,7 +97,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>全局对象 {{jsxref("Global_Objects/NaN", "NaN")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html index b56ef4c920..ac1375763a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html @@ -196,7 +196,7 @@ Child.prototype.getOffsetByInitialPosition = function getOffsetByInitialPosition <p><strong>总结</strong>:手动设置或更新构造函数可能会导致不同且有时令人困惑的后果。为了防止它,只需在每个特定情况下定义构造函数的角色。在大多数情况下,不使用构造函数,并且不需要重新分配构造函数。</p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html index 255cd9ec0c..9bd6e7589c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html @@ -159,7 +159,7 @@ o2 = Object.create({}, { } });</pre> -<h2 id="Polyfill" style="line-height: 24px;">Polyfill</h2> +<h2 id="Polyfill">Polyfill</h2> <p>这个 polyfill 涵盖了主要的应用场景,它创建一个已经选择了原型的新对象,但没有把第二个参数考虑在内。</p> @@ -182,7 +182,7 @@ o2 = Object.create({}, { }; }</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -213,11 +213,11 @@ o2 = Object.create({}, { <p>{{Compat("javascript.builtins.Object.create")}}</p> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.defineProperty")}}</li> <li>{{jsxref("Object.defineProperties")}}</li> <li>{{jsxref("Object.prototype.isPrototypeOf")}}</li> - <li>John Resig's post on <a class="external external-icon" href="http://ejohn.org/blog/objectgetprototypeof/" style="white-space: pre-line;" title="http://ejohn.org/blog/objectgetprototypeof/">getPrototypeOf</a></li> + <li>John Resig's post on <a class="external external-icon" href="http://ejohn.org/blog/objectgetprototypeof/" title="http://ejohn.org/blog/objectgetprototypeof/">getPrototypeOf</a></li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html index e4d9e9ef7a..9758d0af9b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html @@ -141,7 +141,7 @@ Object.defineProperties(obj, { return obj; }</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperty/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperty/index.html index b37662d5ab..74b6088e27 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperty/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperty/index.html @@ -172,7 +172,7 @@ Object.defineProperty(obj, "key", withValue("static")); <h2 id="示例">示例</h2> -<p>如果你想了解如何使用 <code>Object.defineProperty</code> 方法和<em>类二进制标记</em>语法,可以看看这些<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty/Additional_examples" style="line-height: 1.5;">额外示例</a>。</p> +<p>如果你想了解如何使用 <code>Object.defineProperty</code> 方法和<em>类二进制标记</em>语法,可以看看这些<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty/Additional_examples">额外示例</a>。</p> <h3 id="创建属性">创建属性</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html index 947a54007d..bd48ad319b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html @@ -161,7 +161,7 @@ TypeError: 1 is not an object // ES5 code <p>用<code>Object.seal()</code>密封的对象可以改变它们现有的属性。使用<code>Object.freeze()</code> 冻结的对象中现有属性是不可变的。</p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html index 7738e33117..b8432c64bd 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html @@ -27,7 +27,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDes <dd>目标对象内属性名称</dd> </dl> -<h3 id="返回值" style="line-height: 24px;">返回值</h3> +<h3 id="返回值">返回值</h3> <p>如果指定的属性存在于对象上,则返回其属性描述符对象(property descriptor),否则返回 {{jsxref("undefined")}}。</p> @@ -103,7 +103,7 @@ Object.getOwnPropertyDescriptor('foo', 0); // writable: false // }</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -139,7 +139,7 @@ Object.getOwnPropertyDescriptor('foo', 0); <div></div> -<div><strong style="">相关链接</strong> </div> +<div><strong>相关链接</strong> </div> <ul> <li>{{jsxref("Object.defineProperty()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html index b4ad24a572..3f86e43049 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html @@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNam <p>在给定对象上找到的自身属性对应的字符串数组。</p> -<h2 id="Description" name="Description" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="Description" name="Description">描述</h2> <p><code>Object.getOwnPropertyNames()</code> 返回一个数组,该数组对元素是 <code>obj</code>自身拥有的枚举或不可枚举属性名称字符串。 数组中枚举属性的顺序与通过 {{jsxref("Statements/for...in", "for...in")}} 循环(或 {{jsxref("Object.keys")}})迭代该对象属性时一致。数组中不可枚举属性的顺序未定义。</p> @@ -155,7 +155,7 @@ Object.getOwnPropertyNames('foo'); <p>Firefox 28 {{geckoRelease("28")}}之前,<code>Object.getOwnPropertyNames</code> 不会获取到 {{jsxref("Error")}} 对象的属性。该 bug 在后面的版本修复了 ({{bug("724768")}})。</p> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Enumerability_and_ownership_of_properties" title="Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html index df45e04217..2d8e4928f8 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html @@ -65,30 +65,16 @@ Object.prototype === Object.getPrototypeOf( obj ); // true Object.prototype === Object.getPrototypeOf( {} ); // true</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 38px; background: 0px 0px;"> </div> - <h2 id="Notes" name="Notes">Notes</h2> -<p>在 ES5 中,如果参数不是一个对象类型,将抛出一个{{jsxref("TypeError")}}异常。在 ES2015 中,参数会被强制转换为一个 {{jsxref("Object")}}<strong style="font-weight: bold;">。</strong></p> +<p>在 ES5 中,如果参数不是一个对象类型,将抛出一个{{jsxref("TypeError")}}异常。在 ES2015 中,参数会被强制转换为一个 {{jsxref("Object")}}<strong>。</strong></p> <pre class="brush: js">Object.getPrototypeOf('foo'); // TypeError: "foo" is not an object (ES5 code) Object.getPrototypeOf('foo'); // String.prototype (ES2015 code)</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 38px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 57px; background: 0px 0px;"> </div> - -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -129,7 +115,7 @@ Object.getPrototypeOf('foo'); <li>{{jsxref("Object.prototype.isPrototypeOf")}}</li> <li>{{jsxref("Object.setPrototypeOf()")}}</li> <li>{{jsxref("Object.prototype.__proto__")}}</li> - <li>John Resig's post on <a class="external external-icon" href="http://ejohn.org/blog/objectgetprototypeof/" style="white-space: pre-line;" title="http://ejohn.org/blog/objectgetprototypeof/">getPrototypeOf</a></li> + <li>John Resig's post on <a class="external external-icon" href="http://ejohn.org/blog/objectgetprototypeof/" title="http://ejohn.org/blog/objectgetprototypeof/">getPrototypeOf</a></li> <li>{{jsxref("Reflect.getPrototypeOf()")}}</li> <li>{{jsxref("AsyncFunction")}}</li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html index 249ce52673..817dd1296a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html @@ -49,7 +49,7 @@ Object.isExtensible(frozen); // === false <p> </p> -<h2 id="注意" style="margin-bottom: 20px; line-height: 30px;">注意</h2> +<h2 id="注意">注意</h2> <p>在 ES5 中,如果参数不是一个对象类型,将抛出一个 {{jsxref("TypeError")}} 异常。在 ES6 中, non-object 参数将被视为一个不可扩展的普通对象,因此会返回 false 。</p> @@ -60,7 +60,7 @@ Object.isExtensible(1); // false (ES6 code) </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -133,7 +133,7 @@ Object.isExtensible(1); </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li><strong>{{jsxref("Object.preventExtensions")}}</strong></li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html index c923cc5530..9a730a6d2c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html @@ -108,7 +108,7 @@ Object.isFrozen(1); // true (ES2015 code) </pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html index e6a895f345..2a70e41e8e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html @@ -68,7 +68,7 @@ Object.isFrozen(s2); // === false, 属性"p"可写 var s3 = Object.seal({ get p() { return 0; } }); Object.isFrozen(s3); // === true ,访问器属性不考虑可写不可写,只考虑是否可配置</pre> -<h2 id="注意" style="margin-bottom: 20px; line-height: 30px;">注意</h2> +<h2 id="注意">注意</h2> <p>在ES5中,如果这个方法的参数不是一个对象(一个原始类型),那么它会导致{{jsxref("TypeError")}}。在ES2015中,非对象参数将被视为是一个密封的普通对象,只返回<code>true</code>。</p> @@ -78,7 +78,7 @@ Object.isFrozen(s3); // === true ,访问器属性不考虑可写不可写,只 Object.isSealed(1); // true (ES2015 code)</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html index b477b88320..3a778356b0 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html @@ -28,7 +28,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/keys <p>一个表示给定对象的所有可枚举属性的字符串数组。</p> -<h2 id="Description" name="Description" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="Description" name="Description">描述</h2> <p><code>Object.keys</code> 返回一个所有元素为字符串的数组,其元素来自于从给定的<code>object</code>上面可直接枚举的属性。这些属性的顺序与手动遍历该对象属性时的一致。</p> @@ -110,7 +110,7 @@ Object.keys("foo"); <p>另一个简单的实现,参见<a class="external" href="http://tokenposts.blogspot.com.au/2012/04/javascript-objectkeys-browser.html">Javascript - Object.keys Browser Compatibility</a>。</p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html index 9658716cff..f412762462 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html @@ -86,7 +86,7 @@ fixed.__proto__ = { oh: 'hai' };</pre> Object.preventExtensions(1); // 1 (ES2015 code)</pre> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html index 6fd23f3d1d..69d14321ee 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html @@ -105,7 +105,7 @@ Object.seal(1); <p>使用<code>Object.freeze()</code>冻结的对象中的现有属性值是不可变的。用<code>Object.seal()</code>密封的对象可以改变其现有属性值。</p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html index c9f98bebc4..e2627097bd 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html @@ -7,7 +7,7 @@ tags: - Object translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf --- -<div style="margin: 0px; padding: 0px; border: 0px; color: rgb(77, 78, 83); font-family: 'Open Sans', sans-serif; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">{{JSRef}}</div> +<div>{{JSRef}}</div> <p><code><strong>valueOf()</strong></code> 方法返回指定对象的原始值。</p> @@ -81,8 +81,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf <pre class="brush: js">MyNumberType.prototype.valueOf = function() { return customPrimitiveValue; };</pre> -<div class="line-number" style="margin: 1em 0px 0px; border: 0px; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> </div> - <p>有了这样的一个方法,下一次每当<code>MyNumberType</code>要被转换为原始类型值时,JavaScript 在此之前会自动调用自定义的<code>valueOf</code>方法。</p> <p><code>valueOf</code>方法一般都会被 JavaScript 自动调用,但你也可以像下面代码那样自己调用:</p> @@ -90,7 +88,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf <pre class="brush: js">myNumberType.valueOf()</pre> <div class="note"> -<p dir="ltr"><strong style="border: 0px; margin: 0px; padding: 0px;">注意:</strong>字符串上下文中的对象通过 {{jsxref("Object.toString", "toString()")}}方法转换,这与使用<code>valueOf</code>转换为原始字符串的{{jsxref("String")}}对象不同。所有对象都能转换成一个“<code>[object <em>类型</em>]</code>”这种格式的字符串。但是很多对象不能转换为数字,布尔或函数。</p> +<p dir="ltr"><strong>注意:</strong>字符串上下文中的对象通过 {{jsxref("Object.toString", "toString()")}}方法转换,这与使用<code>valueOf</code>转换为原始字符串的{{jsxref("String")}}对象不同。所有对象都能转换成一个“<code>[object <em>类型</em>]</code>”这种格式的字符串。但是很多对象不能转换为数字,布尔或函数。</p> </div> <h2 id="示例">示例</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/parseint/index.html b/files/zh-cn/web/javascript/reference/global_objects/parseint/index.html index 4f2def476a..fad8f4e3cc 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/parseint/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/parseint/index.html @@ -128,7 +128,7 @@ parseInt(0.00000000000434, 10); // 非常小的数值变成 4</pre> <pre class="brush: js">parseInt("0e0",16);</pre> -<h2 id="没有指定_radix_参数时的八进制解析" style="margin-bottom: 20px; line-height: 30px;">没有指定 <code>radix</code> 参数时的八进制解析</h2> +<h2 id="没有指定_radix_参数时的八进制解析">没有指定 <code>radix</code> 参数时的八进制解析</h2> <p>尽管 ECMAScript 3 已经不赞成这种做法,且 ECMAScript 5 已经禁止了这种做法,但是仍然有很多实现环境仍然把以 0 开头的数值字符串(numeric string)解释为一个八进制数。下面的例子可能返回八进制的结果,也可能返回十进制的结果。<strong>总是指定一个基数(radix)可以避免这种不可靠的行为。</strong></p> @@ -139,7 +139,7 @@ parseInt("08"); // 0, '8' 不是八进制数字. </pre> -<h3 id="ECMAScript_5_移除了八进制解析" style="line-height: 24px;">ECMAScript 5 移除了八进制解析</h3> +<h3 id="ECMAScript_5_移除了八进制解析">ECMAScript 5 移除了八进制解析</h3> <p>ECMAScript 5 规范不再允许<code>parseInt</code>函数的实现环境把以<code>0</code>字符开始的字符串作为八进制数值。ECMAScript 5 陈述如下:</p> @@ -149,7 +149,7 @@ parseInt("08"); <p>直至2013年,很多实现环境并没有采取新的规范所规定的做法, 而且由于必须兼容旧版的浏览器,所以<strong>永远都要明确给出radix参数的值.</strong></p> -<h2 id="一个更严格的解析函数" style="margin-bottom: 20px; line-height: 30px;">一个更严格的解析函数</h2> +<h2 id="一个更严格的解析函数">一个更严格的解析函数</h2> <p>有时采用一个更严格的方法来解析整型值很有用。此时可以使用正则表达式:</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/catch/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/catch/index.html index 3bd0a41fd4..addf056e90 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/catch/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/catch/index.html @@ -10,16 +10,16 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/catch <p><strong>catch()</strong> 方法返回一个<a href="/zh-CN/docs/Web/API/Promise">Promise</a>,并且处理拒绝的情况。它的行为与调用{{jsxref("Promise.then", "Promise.prototype.then(undefined, onRejected)")}} 相同。 (事实上, calling <code>obj.catch(onRejected)</code> 内部calls <code>obj.then(undefined, onRejected)</code>).</p> -<h2 id="Syntax" name="Syntax" style="line-height: 30px;">语法</h2> +<h2 id="Syntax" name="Syntax">语法</h2> -<pre class="syntaxbox" style="font-size: 14px;"><var>p.catch(onRejected)</var>; +<pre class="syntaxbox"><var>p.catch(onRejected)</var>; p.catch(function(reason) { // 拒绝 }); </pre> -<h3 id="参数" style="line-height: 24px;">参数</h3> +<h3 id="参数">参数</h3> <dl> <dt><strong>onRejected</strong></dt> @@ -34,15 +34,15 @@ p.catch(function(reason) { </dd> </dl> -<h2 id="Description" name="Description" style="line-height: 30px;">描述</h2> +<h2 id="Description" name="Description">描述</h2> <p><code>catch </code>方法可以用于您的promise组合中的错误处理。</p> <p>Internally calls <code>Promise.prototype.then</code> on the object upon which is called, passing the parameters <code>undefined</code> and the <code>onRejected</code> handler received; then returns the value of that call (which is a {{jsxref("Promise")}}).</p> -<h2 id="示例" style="line-height: 30px;">示例</h2> +<h2 id="示例">示例</h2> -<h3 id="使用链式语句的_catch方法" style="line-height: 24px;">使用链式语句的 <code>catch</code>方法</h3> +<h3 id="使用链式语句的_catch方法">使用链式语句的 <code>catch</code>方法</h3> <pre class="brush: js"><code>var p1 = new Promise(function(resolve, reject) { resolve('Success'); @@ -71,7 +71,7 @@ p1.then(function(value) { console.log('Not fired due to the catch'); });</pre> -<h3 id="捕获抛出的错误" style="line-height: 30px;">捕获抛出的错误</h3> +<h3 id="捕获抛出的错误">捕获抛出的错误</h3> <pre class="brush: js"><code>// 抛出一个错误,大多数时候将调用catch方法 var p1 = new Promise(function(resolve, reject) { @@ -103,7 +103,7 @@ p3.catch(function(e) { console.log(e); // 不会执行 });</code></pre> -<h3 id="如果已决议" style="line-height: 30px;">如果已决议</h3> +<h3 id="如果已决议">如果已决议</h3> <pre><code>//创建一个新的 Promise ,且已决议 var p1 = Promise.resolve("calling next"); @@ -122,7 +122,7 @@ p2.then(function (value) { console.log(reason); });</code></pre> -<h2 id="规范" style="line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -144,11 +144,11 @@ p2.then(function (value) { </tbody> </table> -<h2 id="浏览器兼容性" style="line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript/promise","Promise.prototype.catch")}}</p> -<h2 id="相关链接" style="line-height: 30px;">相关链接</h2> +<h2 id="相关链接">相关链接</h2> <ul> <li>{{jsxref("Promise")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/index.html index 5a5fd2d613..a658fd4338 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/index.html @@ -30,7 +30,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise <p>待定状态的 Promise 对象要么会通过一个值<em>被兑现(fulfilled)</em>,要么会通过一个原因(错误)<em>被拒绝(rejected)</em>。当这些情况之一发生时,我们用 promise 的 then 方法排列起来的相关处理程序就会被调用。如果 promise 在一个相应的处理程序被绑定时就已经被兑现或被拒绝了,那么这个处理程序就会被调用,因此在完成异步操作和绑定处理方法之间不会存在竞争状态。</p> -<p>因为 <code>{{jsxref("Promise.then", "Promise.prototype.then")}}</code> 和 <code style="font-style: normal;">{{jsxref("Promise.catch", "Promise.prototype.catch")}}</code> 方法返回的是 promise, 所以它们可以被链式调用。</p> +<p>因为 <code>{{jsxref("Promise.then", "Promise.prototype.then")}}</code> 和 <code>{{jsxref("Promise.catch", "Promise.prototype.catch")}}</code> 方法返回的是 promise, 所以它们可以被链式调用。</p> <p><img alt="" src="https://mdn.mozillademos.org/files/8633/promises.png" style="height: 297px; width: 801px;"></p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/exec/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/exec/index.html index b7e9edf7ec..8ee22ffa6c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/regexp/exec/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/exec/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/exec <p><code><strong>exec() </strong></code>方法在一个指定字符串中执行一个搜索匹配。返回一个结果数组或 {{jsxref("null")}}。</p> -<p>在设置了 {{jsxref("RegExp.global", "global")}} 或 {{jsxref("RegExp.sticky", "sticky")}} 标志位的情况下(如 <code>/foo/g</code> or <code>/foo/y</code>),JavaScript {{jsxref("RegExp")}} 对象是<strong>有状态</strong>的。他们会将上次成功匹配后的位置记录在 {{jsxref("RegExp.lastIndex", "lastIndex")}} 属性中。使用此特性,<code style="font-size: 1rem; letter-spacing: -0.00278rem;">exec()</code> 可用来对单个字符串中的多次匹配结果进行逐条的遍历(包括捕获到的匹配),而相比之下, {{jsxref("String.prototype.match()")}} 只会返回匹配到的结果。</p> +<p>在设置了 {{jsxref("RegExp.global", "global")}} 或 {{jsxref("RegExp.sticky", "sticky")}} 标志位的情况下(如 <code>/foo/g</code> or <code>/foo/y</code>),JavaScript {{jsxref("RegExp")}} 对象是<strong>有状态</strong>的。他们会将上次成功匹配后的位置记录在 {{jsxref("RegExp.lastIndex", "lastIndex")}} 属性中。使用此特性,<code>exec()</code> 可用来对单个字符串中的多次匹配结果进行逐条的遍历(包括捕获到的匹配),而相比之下, {{jsxref("String.prototype.match()")}} 只会返回匹配到的结果。</p> <p>如果你只是为了判断是否匹配(true或 false),可以使用 {{jsxref("RegExp.test()")}} 方法,或者 {{jsxref("String.search()")}} 方法。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html index a4ca838294..a0bcd500de 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/index.html @@ -30,7 +30,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp <p>以下三种表达式都会创建相同的正则表达式:</p> -<pre class="brush: js" style="font-size: 14px;">/ab+c/i; //字面量形式 +<pre class="brush: js">/ab+c/i; //字面量形式 new RegExp('ab+c', 'i'); // 首个参数为字符串模式的构造函数 new RegExp(/ab+c/, 'i'); // 首个参数为常规字面量的构造函数</pre> @@ -213,7 +213,7 @@ console.log(/[^.]+/.exec(url)[0].substr(7)); // logs "xxx" <p>使用浏览器内建的<a href="/en-US/docs/Web/API/URL_API">URL API</a>而非正则表达式来解析URL是更好的做法</p> </div> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/regexp/lastindex/index.html b/files/zh-cn/web/javascript/reference/global_objects/regexp/lastindex/index.html index f7e667288f..92dadc8159 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/regexp/lastindex/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/regexp/lastindex/index.html @@ -10,41 +10,34 @@ translation_of: Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex --- <div> {{JSRef("Global_Objects", "RegExp")}}</div> -<h2 id="Summary" name="Summary" style="margin-bottom: 20px; line-height: 30px;">概述</h2> +<h2 id="Summary" name="Summary">概述</h2> <p><code><strong>lastIndex</strong></code> 是正则表达式的一个可读可写的整型属性,用来指定下一次匹配的起始索引。</p> <div> {{js_property_attributes(1,0,0)}}</div> -<h2 id="语法" style="margin-bottom: 20px; line-height: 30px;">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; direction: ltr; white-space: normal; text-shadow: none; background-color: rgba(212, 221, 228, 0.498039);"><var>lastIndex</var> = <var>regExpObj</var>.lastIndex;</pre> -<h2 id="Description" name="Description" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="语法">语法</h2> +<pre class="syntaxbox language-html"><var>lastIndex</var> = <var>regExpObj</var>.lastIndex;</pre> +<h2 id="Description" name="Description">描述</h2> <p>只有正则表达式使用了表示全局检索的 "<code>g</code>" 标志时,该属性才会起作用。此时应用下面的规则:</p> <ul> <li>如果 <code>lastIndex</code> 大于字符串的长度,则 <code>regexp.test</code> 和 <code>regexp.exec</code> 将会匹配失败,然后 <code>lastIndex</code> 被设置为 0。</li> - <li>如果 <code>lastIndex</code> 等于字符串的长度,且该正则表达式匹配空字符串,则该正则表达式匹配从 <code>lastIndex</code> 开始的字符串。(then the regular expression matches input starting at <code style="font-style: normal;">lastIndex</code>.)</li> + <li>如果 <code>lastIndex</code> 等于字符串的长度,且该正则表达式匹配空字符串,则该正则表达式匹配从 <code>lastIndex</code> 开始的字符串。(then the regular expression matches input starting at <code>lastIndex</code>.)</li> <li>如果 <code>lastIndex</code> 等于字符串的长度,且该正则表达式不匹配空字符串 ,则该正则表达式不匹配字符串,<code>lastIndex</code> 被设置为 0.。</li> <li>否则,<code>lastIndex</code> 被设置为紧随最近一次成功匹配的下一个位置。</li> </ul> -<h2 id="示例" style="margin-bottom: 20px; line-height: 30px;">示例</h2> +<h2 id="示例">示例</h2> <p>考虑下面的语句:</p> <pre class="brush: js">var re = /(hi)?/g;</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> - </div> + <p>匹配空字符串</p> <pre class="brush: js">console.log(re.exec("hi")); console.log(re.lastIndex);</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> - </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"> - </div> + <p>返回 <code>["hi", "hi"]</code> ,<code>lastIndex</code> 等于 2。</p> <pre class="brush: js">console.log(re.exec("hi")); console.log(re.lastIndex);</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> - </div> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"> - </div> + <p>返回 <code>["", undefined]</code>,即一个数组,其第 0 个元素为匹配的字符串。此种情况下为空字符串,是因为 <code>lastIndex</code> 为 2(且一直是 2),"<code>hi</code>" 长度为 2。</p> -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> <tr> @@ -70,18 +63,18 @@ console.log(re.lastIndex);</pre> </tr> </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{ CompatibilityTable() }}</p> <div> <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> </tr> <tr> <td>Basic support</td> @@ -98,13 +91,13 @@ console.log(re.lastIndex);</pre> <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Chrome for Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Mobile</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -118,7 +111,7 @@ console.log(re.lastIndex);</pre> </tbody> </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> <li>{{jsxref("RegExp.prototype.ignoreCase")}}</li> <li>{{jsxref("RegExp.prototype.global")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/set/clear/index.html b/files/zh-cn/web/javascript/reference/global_objects/set/clear/index.html index 567dd3dc4c..de14cee47c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/set/clear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/set/clear/index.html @@ -112,7 +112,7 @@ mySet.has("bar") // false </table> </div> -<h2 id="相关链接"><strong style="font-size: 2.14285714285714rem; font-weight: 700; letter-spacing: -1px; line-height: 30px;">相关链接</strong></h2> +<h2 id="相关链接"><strong>相关链接</strong></h2> <ul> <li>{{jsxref("Set")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/concat/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/concat/index.html index 7b53403ac2..1f2e37ceb4 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/concat/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/concat/index.html @@ -33,7 +33,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/concat <p>如果参数不是字符串类型,它们在连接之前将会被转换成字符串。</p> -<h2 id="性能" style="margin-bottom: 20px; line-height: 30px;">性能</h2> +<h2 id="性能">性能</h2> <p>强烈建议使用<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment_Operators">赋值操作符</a>(<code>+</code>, <code>+=</code>)代替 <code>concat</code> 方法。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/fixed/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/fixed/index.html index 28dd7c8696..6fd1d90c0d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/fixed/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/fixed/index.html @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/fixed <h2 id="描述">描述</h2> -<p><code style="font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.5;">fixed()</code> 方法将一个字符串包裹在<tt></tt>标签中,比如: <code style="font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.5;">"<tt>str</tt>"</code>.</p> +<p><code>fixed()</code> 方法将一个字符串包裹在<tt></tt>标签中,比如: <code>"<tt>str</tt>"</code>.</p> <h2 id="举例">举例</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/length/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/length/index.html index 9ec301ff64..bf49c313f0 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/length/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/length/index.html @@ -10,11 +10,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/length --- <p>{{JSRef("Global_Objects", "String")}}</p> -<h2 id="Summary" name="Summary" style="margin-bottom: 20px; line-height: 30px;">概述</h2> +<h2 id="Summary" name="Summary">概述</h2> <p><strong>length</strong> 属性表示一个字符串的长度。</p> -<h2 id="Description" name="Description" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="Description" name="Description">描述</h2> <p>该属性返回字符串中字符编码单元的数量。JavaScript 使用 {{ interwiki("wikipedia", "UTF-16") }} 编码,该编码使用一个 16 比特的编码单元来表示大部分常见的字符,使用两个代码单元表示不常用的字符。因此 length 返回值可能与字符串中实际的字符数量不相同。</p> @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/length <p>静态属性 <strong>String.length</strong> 返回 1。</p> -<h2 id="Examples" name="Examples" style="margin-bottom: 20px; line-height: 30px;">示例</h2> +<h2 id="Examples" name="Examples">示例</h2> <pre class="brush: js">var x = "Mozilla"; var empty = ""; @@ -33,23 +33,7 @@ console.log("Mozilla is " + x.length + " code units long"); console.log("The empty string is has a length of " + empty.length); /* "The empty string is has a length of 0" */</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 19px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 38px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 57px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 76px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 95px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 114px; background: 0px 0px;"> </div> - -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 133px; background: 0px 0px;"> </div> - -<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <tbody> @@ -76,7 +60,7 @@ console.log("The empty string is has a length of " + empty.length); </tbody> </table> -<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2> +<h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{ CompatibilityTable() }}</p> @@ -84,12 +68,12 @@ console.log("The empty string is has a length of " + empty.length); <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari</th> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> </tr> <tr> <td>Basic support</td> @@ -107,13 +91,13 @@ console.log("The empty string is has a length of " + empty.length); <table class="compat-table"> <tbody> <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">Chrome for Android</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">IE Mobile</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> @@ -128,8 +112,8 @@ console.log("The empty string is has a length of " + empty.length); </table> </div> -<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2> +<h2 id="See_also" name="See_also">相关链接</h2> <ul> - <li><a class="external external-icon" href="http://developer.teradata.com/blog/jasonstrimpel/2011/11/javascript-string-length-and-internationalizing-web-applications" style="white-space: pre-line;">JavaScript String.length and Internationalizing Web Applications</a></li> + <li><a class="external external-icon" href="http://developer.teradata.com/blog/jasonstrimpel/2011/11/javascript-string-length-and-internationalizing-web-applications">JavaScript String.length and Internationalizing Web Applications</a></li> </ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/replace/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/replace/index.html index 5991e8fa0a..e5930019f1 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/replace/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/replace/index.html @@ -82,13 +82,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/replace <td>插入当前匹配的子串右边的内容。</td> </tr> <tr> - <td style="white-space: nowrap;"><code>$<em>n</em></code></td> + <td><code>$<em>n</em></code></td> <td> <p>假如第一个参数是 {{jsxref("RegExp")}}对象,并且 n 是个小于100的非负整数,那么插入第 n 个括号匹配的字符串。提示:索引是从1开始。如果不存在第 n个分组,那么将会把匹配到到内容替换为字面量。比如不存在第3个分组,就会用“$3”替换匹配到的内容。</p> </td> </tr> <tr> - <td style="white-space: nowrap;"><code><em>$<Name></em></code></td> + <td><code><em>$<Name></em></code></td> <td> 这里<em><code>Name</code></em> 是一个分组名称。如果在正则表达式中并不存在分组(或者没有匹配),这个变量将被处理为空字符串。只有在支持命名分组捕获的浏览器中才能使用。</td> </tr> </tbody> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/slice/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/slice/index.html index 35f5dd5736..b64952f80e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/slice/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/slice/index.html @@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/slice <dt><code>beginIndex</code></dt> <dd>从该索引(以 0 为基数)处开始提取原字符串中的字符。如果值为负数,会被当做 <code>strLength + beginIndex</code> 看待,这里的<code>strLength</code> 是字符串的长度(例如, 如果 <code>beginIndex</code> 是 -3 则看作是:<code>strLength - 3</code>)</dd> <dt><code>endIndex</code></dt> - <dd>可选。在该索引(以 0 为基数)处结束提取字符串。如果省略该参数,<code style="font-style: normal;">slice()</code> 会一直提取到字符串末尾。如果该参数为负数,则被看作是 strLength + endIndex,这里的 strLength 就是字符串的长度(例如,如果 endIndex 是 -3,则是, strLength - 3)。</dd> + <dd>可选。在该索引(以 0 为基数)处结束提取字符串。如果省略该参数,<code>slice()</code> 会一直提取到字符串末尾。如果该参数为负数,则被看作是 strLength + endIndex,这里的 strLength 就是字符串的长度(例如,如果 endIndex 是 -3,则是, strLength - 3)。</dd> </dl> <h3 id="返回值">返回值</h3> @@ -46,7 +46,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/slice <p>例 2:<code>str.slice(2, -1)</code> 提取第三个字符到倒数第一个字符。</p> -<h2 id="Examples" name="Examples" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">例子</h2> +<h2 id="Examples" name="Examples">例子</h2> <h3 id="使用_slice()_创建一个新的字符串">使用 <code>slice()</code> 创建一个新的字符串</h3> @@ -73,7 +73,7 @@ str.slice(-3, -1); // 返回 'us' str.slice(0, -1); // 返回 'The morning is upon us' </pre> -<h2 id="规范" style="margin-bottom: 20px; font-size: 2.14285714285714rem;">规范</h2> +<h2 id="规范">规范</h2> <table class="standard-table"> <thead> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/substr/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/substr/index.html index 2aad2f2647..2fb5de2276 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/substr/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/substr/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/substr <dl> <dt><code>start</code></dt> - <dd>开始提取字符的位置。如果为负值,则被看作 <code style="font-style: normal; line-height: 1.5;">strLength + </code><code style="font-style: normal; line-height: 1.5;">start,其中</code> <code style="font-style: normal; line-height: 1.5;">strLength</code> 为字符串的长度(例如,如果 <code>start</code> 为 <code>-3,则被看作</code> <code>strLength + (-3))。</code></dd> + <dd>开始提取字符的位置。如果为负值,则被看作 <code>strLength + </code><code>start,其中</code> <code>strLength</code> 为字符串的长度(例如,如果 <code>start</code> 为 <code>-3,则被看作</code> <code>strLength + (-3))。</code></dd> </dl> <dl> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html index f556822b2e..7db9f1e146 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html @@ -13,22 +13,22 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/toLowerCase <p><code><strong>toLowerCase()</strong></code> 会将调用该方法的字符串值转为小写形式,并返回。</p> -<h2 id="语法" style="margin-bottom: 20px; line-height: 30px;">语法</h2> +<h2 id="语法">语法</h2> -<pre class="syntaxbox language-html" style="margin-bottom: 0px; padding: 1em; border-left-width: 6px; border-left-style: solid; font-family: Consolas, Monaco, 'Andale Mono', monospace; font-size: 14px; direction: ltr; white-space: normal; text-shadow: none; background-color: rgba(212, 221, 228, 0.498039);"><code class="language-html" style="font-family: Consolas, Monaco, 'Andale Mono', monospace; direction: ltr; color: inherit; text-shadow: none;">str.toLowerCase()</code> +<pre class="syntaxbox language-html"><code class="language-html">str.toLowerCase()</code> </pre> <h3 id="返回值">返回值</h3> <p>一个新的字符串,表示转换为小写的调用字符串。</p> -<h2 id="描述" style="margin-bottom: 20px; line-height: 30px;">描述</h2> +<h2 id="描述">描述</h2> <p><code>toLowerCase</code> 会将调用该方法的字符串值转为小写形式,并返回。<code>toLowerCase</code> 不会影响字符串本身的值。</p> -<h2 id="示例" style="margin-bottom: 20px; line-height: 30px;">示例</h2> +<h2 id="示例">示例</h2> -<h3 id="例子:使用_toLowerCase" style="line-height: 24px;">例子:使用 <code>toLowerCase()</code></h3> +<h3 id="例子:使用_toLowerCase">例子:使用 <code>toLowerCase()</code></h3> <pre class="brush: js">console.log('中文简体 zh-CN || zh-Hans'.toLowerCase()); // 中文简体 zh-cn || zh-hans @@ -36,7 +36,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/toLowerCase console.log( "ALPHABET".toLowerCase() ); // "alphabet"</pre> -<div class="line-number" style="margin-top: 1em; position: absolute; left: 0px; right: 0px; line-height: inherit; top: 0px; background: 0px 0px;"></div> +<div class="line-number"></div> <p><strong>说明</strong></p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/symbol/index.html b/files/zh-cn/web/javascript/reference/global_objects/symbol/index.html index 9473363551..fce5989dd7 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/symbol/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/symbol/index.html @@ -45,7 +45,7 @@ var sym3 = Symbol('foo'); <pre class="brush: js">var sym = new Symbol(); // TypeError</pre> -<p>这会阻止创建一个显式的 Symbol 包装器对象而不是一个 Symbol 值。围绕原始数据类型创建一个显式包装器对象从 ECMAScript 6 开始不再被支持。 然而,现有的原始包装器对象,如 <code style="font-style: normal;">new Boolean</code>、<code style="font-style: normal;">new String</code>以及<code>new Number</code>,因为遗留原因仍可被创建。</p> +<p>这会阻止创建一个显式的 Symbol 包装器对象而不是一个 Symbol 值。围绕原始数据类型创建一个显式包装器对象从 ECMAScript 6 开始不再被支持。 然而,现有的原始包装器对象,如 <code>new Boolean</code>、<code>new String</code>以及<code>new Number</code>,因为遗留原因仍可被创建。</p> <p>如果你真的想创建一个 <u>Symbol 包装器对象 </u>(<code>Symbol wrapper object</code>),你可以使用 <code>Object()</code> 函数:</p> @@ -201,7 +201,7 @@ obj[Object(sym)]; // still 1</code></pre> <h2 id="规范">规范</h2> -<table class="standard-table" style="height: 143px; width: 640px;"> +<table class="standard-table"> <tbody> <tr> <th scope="col">标准</th> @@ -235,5 +235,3 @@ obj[Object(sym)]; // still 1</code></pre> <li><a href="/en-US/docs/Web/JavaScript/Data_structures">Data types and data structures</a></li> <li><a href="https://hacks.mozilla.org/2015/06/es6-in-depth-symbols/">"ES6 In Depth: Symbols"(深入ES6 Symbols ) on hacks.mozilla.org</a></li> </ul> - -<div class="itanywhere-activator" style="left: 41px; top: 3679px; display: none;" title="Google Translator Anywhere"></div> diff --git a/files/zh-cn/web/javascript/reference/global_objects/weakmap/get/index.html b/files/zh-cn/web/javascript/reference/global_objects/weakmap/get/index.html index 4e9692907a..1c335a5ffc 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/weakmap/get/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/weakmap/get/index.html @@ -20,7 +20,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WeakMap/get <h3 id="返回值">返回值</h3> -<h3 id="返回与指定键相关联的值,如果_WeakMap_对象找不到这个键则返回_undefined。">返回与指定键相关联的值,如果 <code style="font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.5;">WeakMap</code> 对象找不到这个键则返回 <code style="font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.5;">undefined</code>。</h3> +<h3 id="返回与指定键相关联的值,如果_WeakMap_对象找不到这个键则返回_undefined。">返回与指定键相关联的值,如果 <code>WeakMap</code> 对象找不到这个键则返回 <code>undefined</code>。</h3> <h2 id="例子">例子</h2> |