aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/errors
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/errors')
-rw-r--r--files/zh-cn/web/javascript/reference/errors/bad_octal/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/errors/deprecated_source_map_pragma/index.html50
-rw-r--r--files/zh-cn/web/javascript/reference/errors/for-each-in_loops_are_deprecated/index.html57
-rw-r--r--files/zh-cn/web/javascript/reference/errors/getter_only/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/errors/missing_formal_parameter/index.html4
-rw-r--r--files/zh-cn/web/javascript/reference/errors/missing_semicolon_before_statement/index.html4
-rw-r--r--files/zh-cn/web/javascript/reference/errors/not_defined/index.html2
7 files changed, 39 insertions, 82 deletions
diff --git a/files/zh-cn/web/javascript/reference/errors/bad_octal/index.html b/files/zh-cn/web/javascript/reference/errors/bad_octal/index.html
index 2f9b5d477e..ff60730174 100644
--- a/files/zh-cn/web/javascript/reference/errors/bad_octal/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/bad_octal/index.html
@@ -27,7 +27,7 @@ Warning: SyntaxError: 09 is not a legal ECMA-262 octal constant.
<p>请注意,不推荐使用八进制字面值和八进制转义序列,并会产生另外的弃用警告。 在 ECMAScript 6 和更高版本里,语法使用前导零后跟小写或大写拉丁字母“O”(0o或0O)。更多信息请查看 <a href="/zh-CN/docs/Web/JavaScript/Reference/Lexical_grammar#Octal">lexical grammar</a>。</p>
<div class="note">
-<p>注意:现在仅 <strong>firefox</strong> 会产生此错误。</p>
+<p><strong>备注:</strong>现在仅 <strong>firefox</strong> 会产生此错误。</p>
</div>
<h2 id="示例">示例</h2>
diff --git a/files/zh-cn/web/javascript/reference/errors/deprecated_source_map_pragma/index.html b/files/zh-cn/web/javascript/reference/errors/deprecated_source_map_pragma/index.html
index 42339a4e85..074e964160 100644
--- a/files/zh-cn/web/javascript/reference/errors/deprecated_source_map_pragma/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/deprecated_source_map_pragma/index.html
@@ -51,55 +51,7 @@ Warning: SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecat
<h2 id="浏览器兼容性">浏览器兼容性</h2>
-<p>{{CompatibilityTable}}</p>
-
-<div>
-<table class="compat-table">
- <tbody>
- <tr>
- <th>Feature</th>
- <th>Chrome</th>
- <th>Firefox (Gecko)</th>
- <th>Internet Explorer</th>
- <th>Opera</th>
- <th>Safari</th>
- </tr>
- <tr>
- <td>New syntax</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{ CompatGeckoDesktop(24) }}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- </tr>
- </tbody>
-</table>
-</div>
-
-<div>
-<table class="compat-table">
- <tbody>
- <tr>
- <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>New syntax</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{ CompatGeckoMobile(24) }}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- <td>{{CompatUnknown}}</td>
- </tr>
- </tbody>
-</table>
-</div>
+{{Compat}}
<h2 id="相关">相关</h2>
diff --git a/files/zh-cn/web/javascript/reference/errors/for-each-in_loops_are_deprecated/index.html b/files/zh-cn/web/javascript/reference/errors/for-each-in_loops_are_deprecated/index.html
index 351be47a9d..ba17973172 100644
--- a/files/zh-cn/web/javascript/reference/errors/for-each-in_loops_are_deprecated/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/for-each-in_loops_are_deprecated/index.html
@@ -29,12 +29,14 @@ translation_of: Web/JavaScript/Reference/Errors/For-each-in_loops_are_deprecated
<h4 id="不赞成这么使用">不赞成这么使用</h4>
<div class="warning">
-<p class="brush: js example-bad">var object = { a: 10, b: 20 };</p>
+<p><strong>警告:</strong></p>
+<pre class="brush: js example-bad">var object = { a: 10, b: 20 };</pre>
-<p class="brush: js example-bad">for each (var x in object) {<br>
-   console.log(x);        // 10<br>
-                          // 20<br>
- }</p>
+<pre class="brush: js example-bad">for each (var x in object) {
+   console.log(x);        // 10
+                          // 20
+ }
+</pre>
</div>
<h4 id="替换语法">替换语法</h4>
@@ -67,13 +69,14 @@ for (var x of Object.values(object)) {
<h4 id="不赞成这么使用_2">不赞成这么使用</h4>
<div class="warning">
-<p class="brush: js example-bad">var array = [10, 20, 30];</p>
-
-<p class="brush: js example-bad">for each (var x in array) {<br>
-   console.log(x);        // 10<br>
-                          // 20<br>
-                          // 30<br>
- }</p>
+<p><strong>警告:</strong></p>
+<pre class="brush: js example-bad">var array = [10, 20, 30];</pre>
+
+<pre class="brush: js example-bad">for each (var x in array) {
+   console.log(x);        // 10
+                          // 20
+                          // 30
+ }</pre>
</div>
<h4 id="替换语法_2">替换语法</h4>
@@ -96,15 +99,16 @@ for (var x of array) {
<h4 id="不赞成这么使用_3">不赞成这么使用</h4>
<div class="warning">
-<p class="brush: js example-bad">function func(array) {<br>
-   for each (var x in array) {<br>
-     console.log(x);<br>
-   }<br>
- }<br>
- func([10, 20]);        // 10<br>
-                        // 20<br>
- func(null);            // prints nothing<br>
- func(undefined);       // prints nothing</p>
+<p><strong>警告:</strong></p>
+<pre class="brush: js example-bad">function func(array) {
+   for each (var x in array) {
+     console.log(x);
+   }
+ }
+ func([10, 20]);        // 10
+                        // 20
+ func(null);            // prints nothing
+ func(undefined);       // prints nothing</pre>
</div>
<h4 id="替换语法_3">替换语法</h4>
@@ -131,12 +135,13 @@ func(undefined); // prints nothing
<p> 不赞成使用{{jsxref("Statements/for_each...in", "for each...in")}}和{{jsxref("Iterator")}} 对象来遍历指定对象的键值对.</p>
<div class="warning">
-<p class="brush: js example-bad">var object = { a: 10, b: 20 };</p>
+<p><strong>警告:</strong></p>
+<pre class="brush: js example-bad">var object = { a: 10, b: 20 };</pre>
-<p class="brush: js example-bad">for each (var [key, value] in Iterator(object)) {<br>
-   console.log(key, value);  // "a", 10<br>
-                             // "b", 20<br>
- }</p>
+<pre class="brush: js example-bad">for each (var [key, value] in Iterator(object)) {
+   console.log(key, value);  // "a", 10
+                             // "b", 20
+ }</pre>
</div>
<h4 id="替换语法_4">替换语法</h4>
diff --git a/files/zh-cn/web/javascript/reference/errors/getter_only/index.html b/files/zh-cn/web/javascript/reference/errors/getter_only/index.html
index 0636f30eea..0beef8d006 100644
--- a/files/zh-cn/web/javascript/reference/errors/getter_only/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/getter_only/index.html
@@ -48,7 +48,7 @@ arc.temperature = 30;
<p>至于修复问题的方法,可以将第 16 行的代码移除,因为它试图为 temperature 属性赋值,或者是为它添加一个 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setter</a> 特性,就像下面这样:</p>
-<pre class="brush: js example-good highlight[12]">"use strict";
+<pre class="brush: js example-good">"use strict";
function Archiver() {
var temperature = null;
diff --git a/files/zh-cn/web/javascript/reference/errors/missing_formal_parameter/index.html b/files/zh-cn/web/javascript/reference/errors/missing_formal_parameter/index.html
index 9d8a069258..1528fbe00e 100644
--- a/files/zh-cn/web/javascript/reference/errors/missing_formal_parameter/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/missing_formal_parameter/index.html
@@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Errors/Missing_formal_parameter
<p>在构造一个函数的时候,函数参数必须为标记符。下面列举的函数声明都是无效的,因为它们在参数部分使用的是数值:</p>
-<pre class="brush: js example-bad highlight:[1,6,11]">function square(3) {
+<pre class="brush: js example-bad">function square(3) {
return number * number;
};
// SyntaxError: missing formal parameter
@@ -47,7 +47,7 @@ function log({ obj: "value"}) {
<p>需要在函数声明中使用标记符:</p>
-<pre class="brush: js example-good highlight:[1,5,9]">function square(number) {
+<pre class="brush: js example-good">function square(number) {
return number * number;
};
diff --git a/files/zh-cn/web/javascript/reference/errors/missing_semicolon_before_statement/index.html b/files/zh-cn/web/javascript/reference/errors/missing_semicolon_before_statement/index.html
index 963008b259..434c765136 100644
--- a/files/zh-cn/web/javascript/reference/errors/missing_semicolon_before_statement/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/missing_semicolon_before_statement/index.html
@@ -61,13 +61,13 @@ array[0] = "there";
<p>如果你用的是另一种编程语言,那么在javaScript中使用不具有相同或完全没有意义的关键字也是很常见的:</p>
-<pre class="brush: js example-bad line-numbers language-js">def print(info){
+<pre class="brush: js example-bad">def print(info){
console.log(info);
}; // SyntaxError missing ; before statement</pre>
<p>因此,建议使用<code>function</code>而不是<code>def</code>:</p>
-<pre class="brush: js example-good line-numbers language-js">function print(info){
+<pre class="brush: js example-good">function print(info){
console.log(info);
};</pre>
diff --git a/files/zh-cn/web/javascript/reference/errors/not_defined/index.html b/files/zh-cn/web/javascript/reference/errors/not_defined/index.html
index cc5fadb2a8..070e804d5c 100644
--- a/files/zh-cn/web/javascript/reference/errors/not_defined/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/not_defined/index.html
@@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Errors/Not_defined
<p>在某些地方引用一个不存在的变量的时候。当你使用变量的时候,这个变量必须是已经被声明的,或者你可以确保它在你当前的脚本或作用域 ({{Glossary("scope")}}) 中可用。</p>
<div class="note">
-<p><strong>注意:</strong> 当你加载一个库的时候(例如 jQuery),请确保你在这个库加载完毕后再使用这个库中的变量,如“$”。将你想加载的库的 {{HTMLElement("script")}} 标签放置在你的代码前面。</p>
+<p><strong>备注:</strong> 当你加载一个库的时候(例如 jQuery),请确保你在这个库加载完毕后再使用这个库中的变量,如“$”。将你想加载的库的 {{HTMLElement("script")}} 标签放置在你的代码前面。</p>
</div>
<h2 id="示例">示例</h2>