aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/errors
diff options
context:
space:
mode:
authorIrvin <irvinfly@gmail.com>2022-02-16 02:02:49 +0800
committerIrvin <irvinfly@gmail.com>2022-02-16 02:35:54 +0800
commit01b0e12ba27b5069248fd09235e9a7143915ee30 (patch)
tree0e9edf538dc3fa3331e1dbb79239b58186765f86 /files/zh-cn/web/javascript/reference/errors
parent6ca84f1794af830ada9736d7289ce29aabb04ca3 (diff)
downloadtranslated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.tar.gz
translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.tar.bz2
translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.zip
remove `notranslate` class in zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/errors')
-rw-r--r--files/zh-cn/web/javascript/reference/errors/cyclic_object_value/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/errors/not_a_function/index.html22
-rw-r--r--files/zh-cn/web/javascript/reference/errors/not_defined/index.html10
3 files changed, 20 insertions, 20 deletions
diff --git a/files/zh-cn/web/javascript/reference/errors/cyclic_object_value/index.html b/files/zh-cn/web/javascript/reference/errors/cyclic_object_value/index.html
index 9ab3cb7b02..b729af45fa 100644
--- a/files/zh-cn/web/javascript/reference/errors/cyclic_object_value/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/cyclic_object_value/index.html
@@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Errors/Cyclic_object_value
<h2 id="提示信息">提示信息</h2>
-<pre class="notranslate">TypeError: cyclic object value (Firefox)
+<pre>TypeError: cyclic object value (Firefox)
TypeError: Converting circular structure to JSON (Chrome and Opera)
TypeError: Circular reference in value argument not supported (Edge)</pre>
@@ -34,7 +34,7 @@ TypeError: Circular reference in value argument not supported (Edge)</pre>
<p>在如下循环结构中:</p>
-<pre class="brush: js notranslate">var a = {};
+<pre class="brush: js">var a = {};
var b = {};
a.child = b;
b.child = a;
@@ -42,7 +42,7 @@ b.child = a;
<p>{{jsxref("JSON.stringify()")}} 将会报错</p>
-<pre class="brush: js example-bad notranslate">JSON.stringify(a);
+<pre class="brush: js example-bad">JSON.stringify(a);
// TypeError: cyclic object value
</pre>
@@ -52,7 +52,7 @@ b.child = a;
<p>注意:以下代码并不会保存循环引用的值。</p>
-<pre class="brush: js example-good notranslate">var seen = [];
+<pre class="brush: js example-good">var seen = [];
var replacer = function(key, value) {
if (typeof value === "object" &amp;&amp; value !== null) {
diff --git a/files/zh-cn/web/javascript/reference/errors/not_a_function/index.html b/files/zh-cn/web/javascript/reference/errors/not_a_function/index.html
index fc4f664e1d..00c3cb3073 100644
--- a/files/zh-cn/web/javascript/reference/errors/not_a_function/index.html
+++ b/files/zh-cn/web/javascript/reference/errors/not_a_function/index.html
@@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Errors/Not_a_function
<h2 id="信息">信息</h2>
-<pre class="notranslate">TypeError: Object doesn't support property or method {x} (Edge)
+<pre>TypeError: Object doesn't support property or method {x} (Edge)
TypeError: "x" is not a function</pre>
<h2 id="错误类型">错误类型</h2>
@@ -47,20 +47,20 @@ TypeError: "x" is not a function</pre>
<p>函数的名称拼写错误,这种情况是经常发生的:</p>
-<pre class="brush: js example-bad notranslate">var x = document.getElementByID("foo");
+<pre class="brush: js example-bad">var x = document.getElementByID("foo");
// TypeError: document.getElementByID is not a function
</pre>
<p>正确的方法名应该是 <code>getElementByI<strong>d:</strong></code></p>
-<pre class="brush: js example-good notranslate">var x = document.getElementById("foo");
+<pre class="brush: js example-good">var x = document.getElementById("foo");
</pre>
<h3 id="调用Object类型中不存在的方法">调用Object类型中不存在的方法</h3>
<p>对于某些特殊的方法,它只属于某些特定的原生对象中,你必须提供一个回调函数才能正常运行。例如:这里调用了一个 {{jsxref("Array.prototype.map()")}} 方法,但是这方法只能被 {{jsxref("Array")}} 对象所调用。 </p>
-<pre class="brush: js example-bad notranslate">var obj = { a: 13, b: 37, c: 42 };
+<pre class="brush: js example-bad">var obj = { a: 13, b: 37, c: 42 };
obj.map(function(num) {
return num * 2;
@@ -70,7 +70,7 @@ obj.map(function(num) {
<p>正确的做法,使用一个数组来代替:</p>
-<pre class="brush: js example-good notranslate">var numbers = [1, 4, 9];
+<pre class="brush: js example-good">var numbers = [1, 4, 9];
numbers.map(function(num) {
return num * 2;
@@ -83,7 +83,7 @@ numbers.map(function(num) {
<p>当您在创建类时,可能会存在某个属性和某个方法的名称相同,当您在调用该函数时,编译器会认为该函数不存在.</p>
-<pre class="brush: js example-bad notranslate">var Dog = function () {
+<pre class="brush: js example-bad">var Dog = function () {
this.age = 11;
this.color = "black";
 this.name = "Ralph";
@@ -102,7 +102,7 @@ myNewDog.name("Cassidy"); //Uncaught TypeError: myNewDog.name is not a function
<p>正确的做法是使用不同的变量名.</p>
-<pre class="brush: js example-good notranslate">var Dog = function () {
+<pre class="brush: js example-good">var Dog = function () {
this.age = 11;
this.color = "black";
 this.dogName = "Ralph"; //Using this.dogName instead of .name
@@ -124,13 +124,13 @@ myNewDog.name("Cassidy"); //Dog { age: 11, color: 'black', dogName: 'Cassidy' }<
<p>使用后者时将会抛出错误:</p>
-<pre class="brush: js example-bad notranslate">const sixteen = 2(3 + 5);
+<pre class="brush: js example-bad">const sixteen = 2(3 + 5);
alert('2 x (3 + 5) is ' + String(sixteen));
//Uncaught TypeError: 2 is not a function</pre>
<p>您可以添加乘法运算符 <code>*</code> 来改正代码:</p>
-<pre class="brush: js example-good notranslate">const sixteen = 2 * (3 + 5);
+<pre class="brush: js example-good">const sixteen = 2 * (3 + 5);
alert('2 x (3 + 5) is ' + String(sixteen));
//2 x (3 + 5) is 16</pre>
@@ -140,7 +140,7 @@ alert('2 x (3 + 5) is ' + String(sixteen));
<p>以下为一个示例模块 (<code>helpers.js</code>)</p>
-<pre class="notranslate">let helpers = function () { };
+<pre>let helpers = function () { };
helpers.groupBy = function (objectArray, property) {
return objectArray.reduce(function (acc, obj) {
@@ -158,7 +158,7 @@ export default helpers;</pre>
<p>在 <code>App.js</code>中正确导入该模块:</p>
-<pre class="notranslate">import helpers from './helpers'</pre>
+<pre>import helpers from './helpers'</pre>
<h2 id="相关">相关</h2>
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 a092f394ec..cc5fadb2a8 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
@@ -7,7 +7,7 @@ translation_of: Web/JavaScript/Reference/Errors/Not_defined
<h2 id="错误信息">错误信息</h2>
-<pre class="syntaxbox notranslate">ReferenceError: "x" is not defined
+<pre class="syntaxbox">ReferenceError: "x" is not defined
</pre>
<h2 id="错误类型">错误类型</h2>
@@ -26,19 +26,19 @@ translation_of: Web/JavaScript/Reference/Errors/Not_defined
<h3 id="变量没有被声明">变量没有被声明</h3>
-<pre class="brush: js example-bad notranslate">foo.substring(1); // ReferenceError: foo is not defined
+<pre class="brush: js example-bad">foo.substring(1); // ReferenceError: foo is not defined
</pre>
<p>“foo” 变量没有在任何地方被声明。它需要是某种字符串,这样 {{jsxref("String.prototype.substring()")}} 方法才可以正常工作。</p>
-<pre class="brush: js example-good notranslate">var foo = 'bar';
+<pre class="brush: js example-good">var foo = 'bar';
foo.substring(1); // "ar"</pre>
<h3 id="错误的作用域">错误的作用域</h3>
<p>变量必须是在它当前的执行环境中可用的。在一个函数(<a href="/en-US/docs/Web/JavaScript/Reference/Functions">function</a>)中定义的变量不能从这个函数外部的任何地方访问,因为这个变量的作用域仅在这个函数的内部。</p>
-<pre class="brush: js example-bad notranslate">function numbers () {
+<pre class="brush: js example-bad">function numbers () {
var num1 = 2,
num2 = 3;
return num1 + num2;
@@ -48,7 +48,7 @@ console.log(num1); // ReferenceError num1 is not defined.</pre>
<p>然而,一个函数可用使用在它所被定义的作用域中的所有变量。换句话说,当一个函数被定义在全局作用域的时候,它可以访问所有在全局作用域中定义的变量。</p>
-<pre class="brush: js example-good notranslate">var num1 = 2,
+<pre class="brush: js example-good">var num1 = 2,
num2 = 3;
function numbers () {