From c40612041809fe289aba58aefa170bbe784aba1f Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:07 +0800 Subject: remove name attribute for zh-CN --- .../reference/global_objects/number/toprecision/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/number/toprecision/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/number/toprecision/index.html b/files/zh-cn/web/javascript/reference/global_objects/number/toprecision/index.html index ec964370f1..ff4e3425c3 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/number/toprecision/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/number/toprecision/index.html @@ -5,22 +5,22 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/toPrecision ---
{{JSRef("Global_Objects", "Number")}}
-

概述

+

概述

toPrecision() 方法以指定的精度返回该数值对象的字符串表示。

-

语法

+

语法

numObj.toPrecision(precision)
-

参数

+

参数

precision
可选。一个用来指定有效数个数的整数。
-

返回值

+

返回值

以定点表示法或指数表示法表示的一个数值对象的字符串表示,四舍五入到 precision 参数指定的显示数字位数。查看 {{jsxref("Number.prototype.toFixed()")}} 方法关于四舍五入的讨论,同样应用于 toPrecision 方法。

@@ -33,7 +33,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Number/toPrecision
如果 precison 参数不在 1 和 100 (包括)之间,将会抛出一个 RangeError 。执行环境也可以支持更大或更小的范围。ECMA-262 只需要最多 21 位显示数字。
-

示例

+

示例

var numObj = 5.123456;
 console.log("numObj.toPrecision()  is " + numObj.toPrecision());  //输出 5.123456
@@ -124,7 +124,7 @@ console.log((1234.5).toPrecision(2)); // "1.2e+3"
 
 
 
-

相关链接

+

相关链接