aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author现阳 <43157411+meakle@users.noreply.github.com>2021-12-05 00:50:19 +0800
committerGitHub <noreply@github.com>2021-12-05 00:50:19 +0800
commit85b59393e35b625d0650e60512ca508372cc3e99 (patch)
treec7dd2e171641a8c8951f0f31fdc13f05f489df2f
parent530dfca848063fd49ef4b73c169bfb9485e12e85 (diff)
downloadtranslated-content-85b59393e35b625d0650e60512ca508372cc3e99.tar.gz
translated-content-85b59393e35b625d0650e60512ca508372cc3e99.tar.bz2
translated-content-85b59393e35b625d0650e60512ca508372cc3e99.zip
Fix syntax highlight Web/JavaScript/Reference/Global_Objects/BigInt, zh-CN (#3260)
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/bigint/index.html12
1 files changed, 6 insertions, 6 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html
index 225cda75d6..5f625f83ad 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html
@@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt
<p>可以用在一个整数字面量后面加 <code>n</code> 的方式定义一个 <code>BigInt</code> ,如:<code>10n</code>,或者调用函数<code>BigInt()</code>。</p>
-<pre><code>const theBiggestInt = 9007199254740991n;
+<pre class="brush: js"><code>const theBiggestInt = 9007199254740991n;
const alsoHuge = BigInt(9007199254740991);
// ↪ 9007199254740991n
@@ -34,12 +34,12 @@ const hugeBin = BigInt("0b11111111111111111111111111111111111111111111111111111"
<p>使用 <code>typeof</code> 测试时, <code>BigInt</code> 对象返回 "bigint" :</p>
-<pre><code>typeof 1n === 'bigint'; // true
+<pre class="brush: js"><code>typeof 1n === 'bigint'; // true
typeof BigInt('1') === 'bigint'; // true</code></pre>
<p>使用 <code>Object</code> 包装后, <code>BigInt</code> 被认为是一个普通 "object" :</p>
-<pre><code>typeof Object(1n) === 'object'; // true</code></pre>
+<pre class="brush: js"><code>typeof Object(1n) === 'object'; // true</code></pre>
<h3 id="运算">运算</h3>
@@ -121,7 +121,7 @@ mixed.sort();
<p>注意被  <code>Object</code> 包装的 <code>BigInt</code>s 使用 object 的比较规则进行比较,只用同一个对象在比较时才会相等。</p>
-<pre><code>0n === Object(0n); // false
+<pre class="brush: js"><code>0n === Object(0n); // false
Object(0n) === Object(0n); // false
const o = Object(0n);
@@ -199,11 +199,11 @@ Boolean(12n)
<p>对任何 <code>BigInt</code> 值使用 {{jsxref("JSON.stringify()")}} 都会引发 <code>TypeError</code>,因为默认情况下 <code>BigInt</code> 值不会在 <code>JSON</code> 中序列化。但是,如果需要,可以实现 <code>toJSON</code> 方法:</p>
-<pre><code>BigInt.prototype.toJSON = function() { return this.toString(); }</code></pre>
+<pre class="brush: js"><code>BigInt.prototype.toJSON = function() { return this.toString(); }</code></pre>
<p><code>JSON.stringify</code> 现在生成如下字符串,而不是抛出异常:</p>
-<pre><code>JSON.stringify(BigInt(1));
+<pre class="brush: js"><code>JSON.stringify(BigInt(1));
// '"1"'</code></pre>
<h2 id="例子">例子</h2>