aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/javascript/reference/statements
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-tw/web/javascript/reference/statements')
-rw-r--r--files/zh-tw/web/javascript/reference/statements/for...in/index.html4
-rw-r--r--files/zh-tw/web/javascript/reference/statements/throw/index.html4
-rw-r--r--files/zh-tw/web/javascript/reference/statements/var/index.html4
3 files changed, 6 insertions, 6 deletions
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 8877c28d79..2c903faf2e 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
@@ -47,11 +47,11 @@ translation_of: Web/JavaScript/Reference/Statements/for...in
<p>A <code>for...in</code> loop iterates over the properties of an object in an arbitrary order (see the <a href="/en-US/docs/JavaScript/Reference/Operators/delete#Cross-browser_issues">delete operator</a> for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). If a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. A property that is deleted before it has been visited will not be visited later. Properties added to the object over which iteration is occurring may either be visited or omitted from iteration. In general it is best not to add, modify or remove properties from the object during iteration, other than the property currently being visited. There is no guarantee whether or not an added property will be visited, whether a modified property (other than the current one) will be visited before or after it is modified, or whether a deleted property will be visited before it is deleted.</p>
-<div class="note" id="hasOwnPropertyNote">
+<div class="note">
<p>If you only want to consider properties attached to the object itself, and not its prototypes, use <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames">getOwnPropertyNames</a> or perform a <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty">hasOwnProperty</a> check (<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable">propertyIsEnumerable</a> can also be used). Alternatively, if you know there won't be any outside code interference, you can extend built-in prototypes with a check method.</p>
</div>
-<div class="note" id="arrayNote">
+<div class="note">
<p><strong><code>for..in</code> 不應該用來迭代一個索引順序很重要的<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array">陣列</a>。</strong> 陣列索引只是以整數命名的可列舉屬性,其他方面等同於一般物件屬性。 無法擔保 <code>for...in</code> 以特定順序傳回索引,並且它將傳回全部可列舉屬性,包括非整數名的,以及繼承而來的可列舉屬性。</p>
<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>
diff --git a/files/zh-tw/web/javascript/reference/statements/throw/index.html b/files/zh-tw/web/javascript/reference/statements/throw/index.html
index dbfe664ef5..9994f8c58c 100644
--- a/files/zh-tw/web/javascript/reference/statements/throw/index.html
+++ b/files/zh-tw/web/javascript/reference/statements/throw/index.html
@@ -179,7 +179,7 @@ e = verifyZipCode('95060 1234'); // returns 95060 1234
<p>{{CompatibilityTable}}</p>
-<div id="compat-desktop">
+<div>
<table class="compat-table">
<tbody>
<tr>
@@ -202,7 +202,7 @@ e = verifyZipCode('95060 1234'); // returns 95060 1234
</table>
</div>
-<div id="compat-mobile">
+<div>
<table class="compat-table">
<tbody>
<tr>
diff --git a/files/zh-tw/web/javascript/reference/statements/var/index.html b/files/zh-tw/web/javascript/reference/statements/var/index.html
index 705a27a333..1a085c5bd9 100644
--- a/files/zh-tw/web/javascript/reference/statements/var/index.html
+++ b/files/zh-tw/web/javascript/reference/statements/var/index.html
@@ -192,7 +192,7 @@ console.log(typeof y); // undefined as y is local to function a</pre>
<p>{{CompatibilityTable}}</p>
-<div id="compat-desktop">
+<div>
<table class="compat-table">
<tbody>
<tr>
@@ -215,7 +215,7 @@ console.log(typeof y); // undefined as y is local to function a</pre>
</table>
</div>
-<div id="compat-mobile">
+<div>
<table class="compat-table">
<tbody>
<tr>