diff options
author | t7yang <t7yang@gmail.com> | 2022-01-10 08:38:07 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | 12a899ab8540bc84f56a0dc6491be80a48499d49 (patch) | |
tree | 45921c6cb67169c837b9bc73b56f469a7c1c24bf /files/zh-tw/web/javascript/reference | |
parent | 563ca0a35e98678e2b7d5f154f31f496851e8d60 (diff) | |
download | translated-content-12a899ab8540bc84f56a0dc6491be80a48499d49.tar.gz translated-content-12a899ab8540bc84f56a0dc6491be80a48499d49.tar.bz2 translated-content-12a899ab8540bc84f56a0dc6491be80a48499d49.zip |
remove name attribute for zh-TW
Diffstat (limited to 'files/zh-tw/web/javascript/reference')
9 files changed, 60 insertions, 60 deletions
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/index.html index fe344c1811..ee63054506 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/index.html @@ -101,7 +101,7 @@ console.log(removedItems); // ["Strawberry", "<code>Mango</code>"] </pre> -<h2 id="Syntax" name="Syntax">語法</h2> +<h2 id="Syntax">語法</h2> <pre class="syntaxbox">[<var>element0</var>, <var>element1</var>, ..., <var>elementN</var>] new Array(<var>element0</var>, <var>element1</var>[, ...[, <var>elementN</var>]]) @@ -117,13 +117,13 @@ new Array(<var>arrayLength</var>)</pre> <dd>如果傳遞給 <code>Array</code> 構造函數的唯一參數是 0 和 2<sup>32</sup>-1(含)之間的整數,將回傳一個新的 JavaScript 陣列,其長度被設定為這個數字。如果參數是任何其他數值,將拋出 {{jsxref("RangeError")}} 異常。</dd> </dl> -<h2 id="Description" name="Description">說明</h2> +<h2 id="Description">說明</h2> <p>Array(「陣列」)是類似列表(list)的物件(Object),它們的原型(Prototype)擁有方法(methods)來執行遍歷和變異操作。JavaScript 陣列的長度(元素數量),以及其元素的類型都不是固定的。取決於工程師如何選擇使用陣列,可以隨時更改陣列的長度,也可不連續儲存資料, 所以並不保證這些資料是集中的。一般情況下,這些特性很方便使用;但若這些功能都不符合您的用途,您可能會想使用型別陣列(typed arrays)。</p> <p>有些人認為即便會發生警告,仍然<a class="external" href="http://www.andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/">不應該使用關聯陣列</a>,而應該使用 {{jsxref("Global_Objects/Object", "objects")}}。您可參考<a class="external" href="http://www.less-broken.com/blog/2010/12/lightweight-javascript-dictionaries.html">輕量級 JavaScript 字典</a>當中的範例。</p> -<h3 id="Accessing_array_elements" name="Accessing_array_elements">存取陣列元素</h3> +<h3 id="Accessing_array_elements">存取陣列元素</h3> <p>JavaScript 陣列是 zero-indexed:陣列元素的索引值編排從 0 開始,而最後一個元素的索引值等同於陣列的 {{jsxref("Array.length", "length")}} 屬性減 1。</p> @@ -166,7 +166,7 @@ renderer['3d'].setTexture(model, 'character.png'); // 程式正常 console.log(promise['var']); </pre> -<h3 id="Relationship_between_length_and_numerical_properties" name="Relationship_between_length_and_numerical_properties"><code>length</code> 與數值屬性的關係</h3> +<h3 id="Relationship_between_length_and_numerical_properties"><code>length</code> 與數值屬性的關係</h3> <p>JavaScript 陣列的 {{jsxref("Array.length", "length")}} 屬性和其數值屬性相關。許多陣列的方法被呼叫時會參考 {{jsxref("Array.length", "length")}} 屬性的值(例如 {{jsxref("Array.join", "join")}}、{{jsxref("Array.slice", "slice")}}、{{jsxref("Array.indexOf", "indexOf")}} 等)。而有另一些方法則會去改變 {{jsxref("Array.length", "length")}} 屬性的值,如 {{jsxref("Array.push", "push")}}、{{jsxref("Array.splice", "splice")}}。</p> @@ -202,7 +202,7 @@ console.log(fruits.length); // 2 <p>在 {{jsxref("Array.length")}} 頁面裡有進一步解釋。</p> </div> -<h3 id="Creating_an_array_using_the_result_of_a_match" name="Creating_an_array_using_the_result_of_a_match">使用 match 回傳結果來建立陣列</h3> +<h3 id="Creating_an_array_using_the_result_of_a_match">使用 match 回傳結果來建立陣列</h3> <p>在字串與正規表示式之間的比對結果會產生一個 javascript 陣列。此陣列內含關於比對資訊的屬性與元素。 這樣的陣列由{{jsxref("RegExp.exec")}}, {{jsxref("String.match")}}, 和 {{jsxref("String.replace")}} 所產生。參考以下範例和表格,會有助於說明這些屬性和元素:</p> @@ -247,7 +247,7 @@ var myArray = myRe.exec('cdbBdbsbz'); </tbody> </table> -<h2 id="Properties" name="Properties">屬性</h2> +<h2 id="Properties">屬性</h2> <dl> <dt>Array.length</dt> @@ -258,7 +258,7 @@ var myArray = myRe.exec('cdbBdbsbz'); <dd>可加入屬性至所有陣列物件。</dd> </dl> -<h2 id="Methods" name="Methods">方法</h2> +<h2 id="Methods">方法</h2> <dl> <dt>{{jsxref("Array.from()")}}</dt> @@ -269,25 +269,25 @@ var myArray = myRe.exec('cdbBdbsbz'); <dd>用可變數量的引數來建立新的 <code>Array</code> 實例,不論引數的數量或型別。</dd> </dl> -<h2 id="Array_instances" name="Array_instances"><code>Array</code> 實例</h2> +<h2 id="Array_instances"><code>Array</code> 實例</h2> <p>所有的陣列實例都繼承自 {{jsxref("Array.prototype")}}。若修改這個陣列建構子 (Array constructor) 的原型物件 (prototype object),將會影響所有的陣列實體。</p> -<h3 id="Methods_of_array_instances" name="Methods_of_array_instances">屬性</h3> +<h3 id="Methods_of_array_instances">屬性</h3> <div>{{page('/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Properties')}}</div> -<h3 id="Methods_of_array_instances" name="Methods_of_array_instances">方法</h3> +<h3 id="Methods_of_array_instances">方法</h3> -<h4 id="Mutator_methods" name="Mutator_methods">Mutator methods</h4> +<h4 id="Mutator_methods">Mutator methods</h4> <div>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Mutator_methods')}}</div> -<h4 id="Accessor_methods" name="Accessor_methods">Accessor methods</h4> +<h4 id="Accessor_methods">Accessor methods</h4> <div>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Accessor_methods')}}</div> -<h4 id="Iteration_methods" name="Iteration_methods">Iteration methods</h4> +<h4 id="Iteration_methods">Iteration methods</h4> <div>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Iteration_methods')}}</div> @@ -324,9 +324,9 @@ if (Array.prototype.every.call(str, isLetter)) { } </pre> -<h2 id="Examples" name="Examples">範例</h2> +<h2 id="Examples">範例</h2> -<h3 id="Example_Creating_an_array" name="Example:_Creating_an_array">範例:建立陣列</h3> +<h3 id="Example_Creating_an_array">範例:建立陣列</h3> <p>以下範例會產生長度為 0 的 <code>msgArray</code> 陣列,然後指派字串值到 <code>msgArray[0]</code> 及 <code>msgArray[99]</code>,使陣列的長度變為 100。</p> @@ -339,7 +339,7 @@ if (msgArray.length === 100) { } </pre> -<h3 id="Example_Creating_a_two-dimensional_array" name="Example:_Creating_a_two-dimensional_array">建立二維陣列</h3> +<h3 id="Example_Creating_a_two-dimensional_array">建立二維陣列</h3> <p>以下範例會用字串產生一張西洋棋盤的二維陣列。第一步是將士兵 'p' 從 (6,4) 移動至 (4,4),然後清空原本的位置 (6,4)。</p> @@ -408,7 +408,7 @@ console.table(values)</pre> <p>(第一欄為索引)</p> -<h2 id="Specifications" name="Specifications">規範</h2> +<h2 id="Specifications">規範</h2> <table class="standard-table"> <tbody> @@ -440,13 +440,13 @@ console.table(values)</pre> </tbody> </table> -<h2 id="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</h2> +<h2 id="Browser_compatibility">瀏覽器相容性</h2> <p>{{Compat("javascript.builtins.Array")}}</p> -<h2 id="See_also" name="See_also">參見</h2> +<h2 id="See_also">參見</h2> <ul> <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Indexing_object_properties">JavaScript Guide: “Indexing object properties”</a></li> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html index f610cd1f54..771c17454d 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html @@ -22,11 +22,11 @@ Array.isArray('foobar'); // false Array.isArray(undefined); // false </pre> -<h2 id="Syntax" name="Syntax">語法</h2> +<h2 id="Syntax">語法</h2> <pre class="syntaxbox">Array.isArray(<var>obj</var>)</pre> -<h3 id="Parameters" name="Parameters">參數</h3> +<h3 id="Parameters">參數</h3> <dl> <dt><code>obj</code></dt> @@ -37,13 +37,13 @@ Array.isArray(undefined); // false <p>若物件為 {{jsxref("Array")}} 回傳 <code>true</code>;否則回傳 <code>false</code>。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>檢查傳入的物件是否為陣列({{jsxref("Array")}}),如果是便回傳 <code>true</code>,否則回傳 <code>false</code>。</p> <p>更多細節請參考 <a href="http://web.mit.edu/jwalden/www/isArray.html">“Determining with absolute accuracy whether or not a JavaScript object is an array”</a>。</p> -<h2 id="Examples" name="Examples">範例</h2> +<h2 id="Examples">範例</h2> <pre class="brush: js">// 下方都回傳 true Array.isArray([]); @@ -92,7 +92,7 @@ arr instanceof Array; // false } </pre> -<h2 id="Specifications" name="Specifications">規範</h2> +<h2 id="Specifications">規範</h2> <table class="standard-table"> <tbody> @@ -119,7 +119,7 @@ arr instanceof Array; // false </tbody> </table> -<h2 id="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</h2> +<h2 id="Browser_compatibility">瀏覽器相容性</h2> <div> @@ -127,7 +127,7 @@ arr instanceof Array; // false <p>{{Compat("javascript.builtins.Array.isArray")}}</p> </div> -<h2 id="See_also" name="See_also">參見</h2> +<h2 id="See_also">參見</h2> <ul> <li>{{jsxref("Array")}}</li> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html index d3104c28be..bf08c27d63 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html @@ -16,7 +16,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/reverse -<h2 id="Syntax" name="Syntax">語法</h2> +<h2 id="Syntax">語法</h2> <pre class="syntaxbox"><var>a</var>.reverse()</pre> @@ -24,13 +24,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/reverse <p>反轉後的陣列。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>reverse</code> 方法將原地(in place)變換(transposes)呼叫此方法的陣列物件之元素至其顛倒的位置,改變原陣列後,並回傳此陣列之參考位址(reference)。</p> -<h2 id="Examples" name="Examples">範例</h2> +<h2 id="Examples">範例</h2> -<h3 id="Example:_Reversing_the_elements_in_an_array" name="Example:_Reversing_the_elements_in_an_array">反轉陣列中之元素</h3> +<h3 id="Example:_Reversing_the_elements_in_an_array">反轉陣列中之元素</h3> <p>下列範例建立了一個包含三個元素的陣列 <code>a</code>,接著反轉此陣列。呼叫 <code>reverse()</code> 會回傳一個反轉後的原陣列 <code>a</code> 之參考。</p> @@ -41,7 +41,7 @@ console.log(a); // ['three', 'two', 'one'] console.log(reversed); // ['three', 'two', 'one'] </pre> -<h2 id="Specifications" name="Specifications">規範</h2> +<h2 id="Specifications">規範</h2> <table class="standard-table"> <tbody> diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html index bfb0eb739f..8b94b496fe 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html @@ -18,12 +18,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/sort -<h2 id="Syntax" name="Syntax">語法</h2> +<h2 id="Syntax">語法</h2> <pre class="syntaxbox"><var>arr</var>.sort(<var>[compareFunction]</var>) </pre> -<h3 id="Parameters" name="Parameters">參數</h3> +<h3 id="Parameters">參數</h3> <dl> <dt><code>compareFunction</code> {{optional_inline}}</dt> @@ -34,7 +34,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/sort <p>排序後的陣列。請注意此為<em><a href="https://zh.wikipedia.org/wiki/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95">原地(in place)</a></em>進行排序過的陣列,並且不是原陣列的拷貝。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>如果 <code>compareFunction</code> 沒有被應用,元素將被轉換為字串並以 Unicode 編碼位置進行比較來排序。舉例來說,"Banana" 會被排在 "cherry" 之前。在數值排序中,9 排在 80 前面,但因為數字被轉換成字串,在 Unicode 順序中 "80" 會在 "9" 的前面。</p> @@ -112,7 +112,7 @@ items.sort(function(a, b) { <h2 id="範例">範例</h2> -<h3 id="Example:_Creating.2C_displaying.2C_and_sorting_an_array" name="Example:_Creating.2C_displaying.2C_and_sorting_an_array">建立、顯示及排序一個陣列</h3> +<h3 id="Example:_Creating.2C_displaying.2C_and_sorting_an_array">建立、顯示及排序一個陣列</h3> <p>下列範例建立了四個陣列並顯示其原本陣列內容、再進行排序。數字陣列先不使用比較函式(compare function)來排序,接著才依據比較函式進行排序。</p> @@ -159,7 +159,7 @@ Sorted without a compare function: 1,200,40,5,700,80,9 Sorted with compareNumbers: 1,5,9,40,80,200,700 </pre> -<h3 id="Example:_Sorting_non-ASCII_characters" name="Example:_Sorting_non-ASCII_characters">排序非 ASCII 字元</h3> +<h3 id="Example:_Sorting_non-ASCII_characters">排序非 ASCII 字元</h3> <p>為了排列非 ASCII 字元,即重音節字元(e、é、è、a、ä 等等),非英語字串:利用 {{jsxref("String.localeCompare")}}。此函式將比較這些字元,所以結果將會顯示正確的順序。</p> @@ -171,7 +171,7 @@ items.sort(function (a, b) { // items is ['adieu', 'café', 'cliché', 'communiqué', 'premier', 'réservé'] </pre> -<h3 id="Example:_Sorting_maps" name="Example:_Sorting_maps">排序 map</h3> +<h3 id="Example:_Sorting_maps">排序 map</h3> <p><code>compareFunction</code> 可以被陣列中的各個元素多次呼叫。依據 <code>compareFunction</code> 的特性,這將會產生大量運算。越多元素要排序 <code>compareFunction</code> 就越多工作要做,因此選擇使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/map">map</a> 來排列也就是一個更明智的選擇。作法為先迭代陣列一次來取得排序時所需的值至暫時的陣列,並對此臨時陣列進行排序。然後再迭代臨時陣列來將正確順序之值放入原始陣列中。</p> @@ -200,7 +200,7 @@ var result = mapped.map(function(el){ }); </pre> -<h2 id="Specifications" name="Specifications">規範</h2> +<h2 id="Specifications">規範</h2> <table class="standard-table"> <tbody> @@ -232,7 +232,7 @@ var result = mapped.map(function(el){ </tbody> </table> -<h2 id="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</h2> +<h2 id="Browser_compatibility">瀏覽器相容性</h2> <div> @@ -240,7 +240,7 @@ var result = mapped.map(function(el){ <p>{{Compat("javascript.builtins.Array.sort")}}</p> </div> -<h2 id="See_also" name="See_also">參見</h2> +<h2 id="See_also">參見</h2> <ul> <li>{{jsxref("Array.prototype.reverse()")}}</li> diff --git a/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html b/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html index fdc8f8d1d0..98f01ef784 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html @@ -76,7 +76,7 @@ JSON.stringify( Object.create(null, { x: { value: 'x', enumerable: false }, y: { </pre> -<h3 id="The_replacer_parameter"><a name="The replacer parameter"></a>The <code>replacer</code> parameter</h3> +<h3 id="The_replacer_parameter"><a></a>The <code>replacer</code> parameter</h3> <p>The <code>replacer</code> parameter can be either a function or an array. As a function, it takes two parameters, the key and the value being stringified. The object in which the key was found is provided as the replacer's <code>this</code> parameter. Initially it gets called with an empty key representing the object being stringified, and it then gets called for each property on the object or array being stringified. It should return the value that should be added to the JSON string, as follows:</p> @@ -113,7 +113,7 @@ JSON.stringify(foo, replacer); // '{"week":45,"month":7}', only keep "week" and "month" properties </pre> -<h3 id="The_space_argument"><a name="The space argument"></a>The <code>space</code> argument</h3> +<h3 id="The_space_argument"><a></a>The <code>space</code> argument</h3> <p>The <code>space</code> argument may be used to control spacing in the final string. If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will be indented by this string (or the first ten characters of it).</p> diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html index a95240343f..fc2306a8a1 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html @@ -45,7 +45,7 @@ var copy = Object.assign({}, obj); console.log(copy); // { a: 1 } </pre> -<h3 id="Deep_Clone" name="Deep_Clone">警告:非深層複製</h3> +<h3 id="Deep_Clone">警告:非深層複製</h3> <p>深層複製(deep clone)需要使用其他的替代方案,因為 <code>Object.assign()</code> 僅複製屬性值。若來源物件的值參照到一個子物件,它只會複製該子物件的參照。</p> diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/index.html index 8ab9244b71..e29b6b8cea 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/index.html +++ b/files/zh-tw/web/javascript/reference/global_objects/string/index.html @@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String <p><strong><code>String</code></strong> 全域物件為字串的構造函數,或是一個字符序列。</p> -<h2 id="Syntax" name="Syntax">語法</h2> +<h2 id="Syntax">語法</h2> <p>字串文字採用下列形式:</p> @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String <pre>String(thing)</pre> -<h3 id="Parameters" name="Parameters">參數</h3> +<h3 id="Parameters">參數</h3> <dl> <dt><code>thing</code></dt> @@ -130,11 +130,11 @@ otherwise my code is unreadable.";</code></pre> <p>這兩個方法都會建立相同的字串內容。</p> -<h2 id="Description" name="Description">說明</h2> +<h2 id="Description">說明</h2> <p>字串對於能保留以文字形式表達的資料這件事來說,是有用的。在字串上,一些最常被使用的運算即確認字串長度 {{jsxref("String.length", "length")}} ,用 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/String_Operators">+ 或 += 字串運算元</a> 建造或者串接字串,用 {{jsxref("String.indexOf", "indexOf")}} 方法檢查?子字串是否存在或子字串的位置,或者是用 {{jsxref("String.substring", "substring")}} 方法將子字串抽取出來。</p> -<h3 id="Character_access" name="Character_access">存取字元</h3> +<h3 id="Character_access">存取字元</h3> <p>有兩個方法可以存取字串中個別的字元。第一個是用 {{jsxref("String.charAt", "charAt")}} 方法:</p> @@ -148,7 +148,7 @@ otherwise my code is unreadable.";</code></pre> <p>對於存取字元使用的括號表達式,沒辦法去刪除或指派一個值給這些屬性。 這些屬性既非可寫的,也非可設定的。(參見 {{jsxref("Object.defineProperty")}})</p> -<h3 id="Comparing_strings" name="Comparing_strings">比較字串</h3> +<h3 id="Comparing_strings">比較字串</h3> <p>C 語言的開發者有 <code>strcmp()</code> 函式可以用來比較字串。 在 JavaScript 中,你只能用<a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">小於和大於運算子</a>:</p> @@ -194,7 +194,7 @@ console.log(eval(s2)); // 回傳字串 "2 + 2" <div class="note"><strong>注意:</strong> 對於在 JavaScript 中其他可用的字串方法,請參閱這篇文章<a href="/en-US/docs/Web/JavaScript/Typed_arrays/StringView" title="/en-US/docs/Web/JavaScript/Typed_arrays/StringView"><code>StringView</code> – a C-like representation of strings based on typed arrays</a>。</div> -<h2 id="Properties" name="Properties">屬性</h2> +<h2 id="Properties">屬性</h2> <dl> <dt>{{jsxref("String.prototype")}}</dt> @@ -203,7 +203,7 @@ console.log(eval(s2)); // 回傳字串 "2 + 2" <div>{{jsOverrides("Function", "Properties", "prototype")}}</div> -<h2 id="Methods" name="Methods">方法</h2> +<h2 id="Methods">方法</h2> <dl> <dt>{{jsxref("String.fromCharCode()")}}</dt> @@ -261,7 +261,7 @@ alert(String.replace(num, /5/, '2')); } }());</pre> -<h2 id="String_instances" name="String_instances"><code>String</code> instances</h2> +<h2 id="String_instances"><code>String</code> instances</h2> <h3 id="Properties_2">Properties</h3> diff --git a/files/zh-tw/web/javascript/reference/operators/typeof/index.html b/files/zh-tw/web/javascript/reference/operators/typeof/index.html index 92d02f05bf..e7f4c388e8 100644 --- a/files/zh-tw/web/javascript/reference/operators/typeof/index.html +++ b/files/zh-tw/web/javascript/reference/operators/typeof/index.html @@ -35,11 +35,11 @@ translation_of: Web/JavaScript/Reference/Operators/typeof <pre><code>typeof <code><em>operand</em></code></code></pre> -<h2 id="Parameters" name="Parameters">參數</h2> +<h2 id="Parameters">參數</h2> <div><code><em>operand</em></code> 表示式代表傳入的物件或原始型別。</div> -<h2 id="Description" name="Description">說明</h2> +<h2 id="Description">說明</h2> <p>下表摘要列出了 <code>typeof 可能的傳回值</code>:</p> @@ -170,7 +170,7 @@ typeof /s/ === 'object'; // Firefox 5+ ... // 符合 ECMAScript 5.1 <p><a class="external" href="http://ecma-international.org/ecma-262/5.1/#sec-11.4.3">ECMA-262 section 11.4.3</a></p> -<h2 id="See_also" name="See_also">參照</h2> +<h2 id="See_also">參照</h2> <ul> <li><a href="/en-US/docs/JavaScript/Reference/Operators/instanceof" title="/en-US/docs/JavaScript/Reference/Operators/instanceof">instanceof</a></li> diff --git a/files/zh-tw/web/javascript/reference/statements/for...in/index.html b/files/zh-tw/web/javascript/reference/statements/for...in/index.html index 2c903faf2e..92ab3aa5c0 100644 --- a/files/zh-tw/web/javascript/reference/statements/for...in/index.html +++ b/files/zh-tw/web/javascript/reference/statements/for...in/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Statements/for...in --- <p>{{jsSidebar("Statements")}}</p> -<h2 id="Summary" name="Summary">Summary</h2> +<h2 id="Summary">Summary</h2> <p>迭代物件的可列舉屬性。對每個相異屬性,執行陳述式。</p> @@ -27,12 +27,12 @@ translation_of: Web/JavaScript/Reference/Statements/for...in </tbody> </table> -<h2 id="Syntax" name="Syntax">語法</h2> +<h2 id="Syntax">語法</h2> <pre class="syntaxbox">for (<var>變數</var> in <var>物件</var>) {<em>...</em> }</pre> -<h3 id="Parameters" name="Parameters">參數</h3> +<h3 id="Parameters">參數</h3> <dl> <dt><code>變數</code></dt> @@ -41,7 +41,7 @@ translation_of: Web/JavaScript/Reference/Statements/for...in <dd>Object whose enumerable properties are iterated.</dd> </dl> -<h2 id="Description" name="Description">Description</h2> +<h2 id="Description">Description</h2> <p><code>for...in</code> 迴圈只迭代可列舉屬性。由內建建構式(如:Array、Object) 製造的物件,從 <code>Object.prototype</code> 和 <code>String.prototype</code> 繼承了不可列舉屬性,如: <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String">String</a></code>的<code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf">indexOf</a></code> 方法,或 <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object">Object</a></code>的 <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString">toString</a></code> 方法。 迴圈將迭代全部可列舉屬性,包括了物件自身的和物件繼承自它的建構式之原型的可列舉屬性。(原型鏈上較接近物件的屬性覆蓋原型的屬性)</p> @@ -57,7 +57,7 @@ translation_of: Web/JavaScript/Reference/Statements/for...in <p>因為迭代的順序依賴於 JavaScript 引擎的實作,在不同引擎下,迭代一個陣列可能不是以一個一致的順序存取陣列元素。因此,當你迭代陣列,且該陣列的存取順序很重要時,最好是使用以數值索引的 <a href="/en-US/docs/JavaScript/Reference/Statements/for">for</a> 迴圈 (或 <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach">Array.forEach</a> 或非標準 <code><a href="/en-US/docs/JavaScript/Reference/Statements/for...of">for...of</a></code> 迴圈)。</p> </div> -<h2 id="Example" name="Example">Examples</h2> +<h2 id="Example">Examples</h2> <p>The following function takes as its arguments an object and the object's name. It then iterates over all the object's enumerable properties and returns a string of the property names and their values.</p> @@ -102,7 +102,7 @@ o = new ColoredTriangle(); alert(show_own_props(o, "o")); /* alerts: o.color = red */ </pre> -<h2 id="See_also" name="See_also">See also</h2> +<h2 id="See_also">See also</h2> <ul> <li><a href="/en-US/docs/JavaScript/Reference/Statements/for...of"><code>for...of</code></a> - a similar statement that iterates over the property <em>values</em></li> |