From d9e9adb5f80a819fe46349bcf6d1faec734b09cd Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:07:31 +0800 Subject: remove span tag in zh-CN --- .../reference/global_objects/math/abs/index.html | 2 +- .../reference/global_objects/math/cbrt/index.html | 4 ++-- .../reference/global_objects/math/clz32/index.html | 2 +- .../reference/global_objects/math/expm1/index.html | 2 +- .../reference/global_objects/math/floor/index.html | 2 +- .../reference/global_objects/math/imul/index.html | 4 ++-- .../reference/global_objects/math/log10/index.html | 2 +- .../reference/global_objects/math/pi/index.html | 8 ++++---- .../reference/global_objects/math/pow/index.html | 2 +- .../reference/global_objects/math/random/index.html | 20 ++++++++++---------- .../reference/global_objects/math/sign/index.html | 12 ++++++------ 11 files changed, 30 insertions(+), 30 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/math') diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html index 13f5f96b79..60747a871d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/abs/index.html @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/abs

说明

-

由于 Math.abs()  Math 中的一个静态方法,你应该通过 Math.abs() 调用。(Math 不是构造器)

+

由于 Math.abs()  Math 中的一个静态方法,你应该通过 Math.abs() 调用。(Math 不是构造器)

示例

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/cbrt/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/cbrt/index.html index d583caf717..96d8b00a37 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/cbrt/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/cbrt/index.html @@ -34,7 +34,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt

而不是作为您创建的Math对象的方法(Math不是构造函数)。

-

cbrt 是 "cube root" 的缩写, 意思是立方根.

+

cbrt 是 "cube root" 的缩写, 意思是立方根.

示例

@@ -50,7 +50,7 @@ Math.cbrt(Infinity); // Infinity Math.cbrt(null); // 0 Math.cbrt(2); // 1.2599210498948734 -

Polyfill

+

Polyfill

为了与旧版浏览器兼容, 可使用下方函数模拟cbrt():

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html index ec23e5ab09..bd41c06b44 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/clz32/index.html @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/clz32

NaN, Infinity, -Infinity 这三个数字转成 32 位无符号整形数字后都是 0.

-

这个函数主要用于那些编译目标为 JS 语言的系统中, 比如 Emscripten.

+

这个函数主要用于那些编译目标为 JS 语言的系统中, 比如 Emscripten.

示例

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html index 74502e9d83..f7baeb0486 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/expm1/index.html @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/expm1

描述

-

参数 x 会被自动类型转换成 number 类型.

+

参数 x 会被自动类型转换成 number 类型.

expm1 是 "exponent minus 1" 的缩写.

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/floor/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/floor/index.html index 91e6f0c395..530f15a033 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/floor/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/floor/index.html @@ -146,7 +146,7 @@ Math.ceil10(-59, 1); // -50 - {{SpecName('ES6', '#sec-math.floor', 'Math.floor')}} + {{SpecName('ES6', '#sec-math.floor', 'Math.floor')}}  {{Spec2('ES6')}} diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/imul/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/imul/index.html index 67da70040d..9d0e9f1c29 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/imul/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/imul/index.html @@ -45,7 +45,7 @@ Math.imul(0xfffffffe, 5) //-10

下面的 JavaScript 代码可以实现该函数:

-
if (!Math.imul) Math.imul = function(a, b) {
+
if (!Math.imul) Math.imul = function(a, b) {
   var aHi = (a >>> 16) & 0xffff;
   var aLo = a & 0xffff;
   var bHi = (b >>> 16) & 0xffff;
@@ -57,7 +57,7 @@ Math.imul(0xfffffffe, 5) //-10
 
 

然而,下面的实现性能会更好一些。因为运行这段 polyfill 的浏览器很有可能会在内部使用浮点数,而不是整数表示 javascript 的 Number。

-
if (!Math.imul) Math.imul = function(opA, opB) {
+
if (!Math.imul) Math.imul = function(opA, opB) {
   opB |= 0; // ensure that opB is an integer. opA will automatically be coerced.
   // floating points give us 53 bits of precision to work with plus 1 sign bit
   // automatically handled for our convienence:
diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/log10/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/log10/index.html
index 7819f922e8..3b8aefc6ed 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/math/log10/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/math/log10/index.html
@@ -9,7 +9,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/log10
 
 

概述

-

Math.log10() 函数返回一个数字以 10 为底的对数.

+

Math.log10() 函数返回一个数字以 10 为底的对数.

语法

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html index 77f373196e..69b5ab79d1 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html @@ -23,11 +23,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI

下面的函数使用 Math.PI 计算给定半径的圆周长:

-
function calculateCircumference (radius) {
-  return 2 * Math.PI * radius;
-}
+
function calculateCircumference (radius) {
+  return 2 * Math.PI * radius;
+}
 
-calculateCircumference(1);  // 6.283185307179586
+calculateCircumference(1); // 6.283185307179586

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html index 32489252c0..3ede0647ac 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/pow/index.html @@ -5,7 +5,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/pow ---
{{JSRef}}
-

Math.pow() 函数返回基数(base)的指数(exponent)次幂,即 baseexponent

+

Math.pow() 函数返回基数(base)的指数(exponent)次幂,即 baseexponent

{{EmbedInteractiveExample("pages/js/math-pow.html")}}

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html index efc11b6894..e25608ec05 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/random/index.html @@ -50,11 +50,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random

这个例子返回了一个在指定值之间的随机整数。这个值不小于 min (如果 min 不是整数,则不小于 min 的向上取整数),且小于(不等于)max

-
function getRandomInt(min, max) {
-  min = Math.ceil(min);
-  max = Math.floor(max);
-  return Math.floor(Math.random() * (max - min)) + min; //不含最大值,含最小值
-}
+
function getRandomInt(min, max) {
+  min = Math.ceil(min);
+  max = Math.floor(max);
+  return Math.floor(Math.random() * (max - min)) + min; //不含最大值,含最小值
+}

也许很容易想到用 Math.round() 来实现,但是这会导致你的随机数处于一个不均匀的分布,这可能不符合你的需求。

@@ -64,11 +64,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/random

上一个例子提到的函数 getRandomInt() 结果范围包含了最小值,但不含最大值。如果你的随机结果需要同时包含最小值和最大值,怎么办呢?  getRandomIntInclusive() 函数可以实现。

-
function getRandomIntInclusive(min, max) {
-  min = Math.ceil(min);
-  max = Math.floor(max);
-  return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值 
-}
+
function getRandomIntInclusive(min, max) {
+  min = Math.ceil(min);
+  max = Math.floor(max);
+  return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值 
+}

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/sign/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/sign/index.html index ca7678c9f0..9c41082511 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/math/sign/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/math/sign/index.html @@ -50,12 +50,12 @@ Math.sign(); // NaN

Polyfill

-
function sign(x) {
-    x = +x ;// convert to a number
-    if (x === 0 || isNaN(x))
-        return x;
-    return x > 0 ? 1 : -1;
-}
+
function sign(x) {
+    x = +x ;// convert to a number
+    if (x === 0 || isNaN(x))
+        return x;
+    return x > 0 ? 1 : -1;
+}

 

-- cgit v1.2.3-54-g00ecf