From 8b02a68e883c62b224d9f93bf8e56d2fbe5b48ae Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 6 Sep 2022 13:17:29 +0800 Subject: [PATCH] docs: update syntax-uts.md --- docs/tutorial/syntax-uts.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/tutorial/syntax-uts.md b/docs/tutorial/syntax-uts.md index 74fbc09ed..888a5ac32 100644 --- a/docs/tutorial/syntax-uts.md +++ b/docs/tutorial/syntax-uts.md @@ -1663,6 +1663,26 @@ console.log(map1.has('bar')); 添加或更新一个指定了键(key)和值(value)的(新)键值对。 +### Number + +Number 对象是经过封装的能让你处理数字值的对象。 + +#### 实例方法 + +#### toFixed + +toFixed() 方法使用定点表示法来格式化一个数值。 + +```ts +function financial(x: Number): String { + return x.toFixed(2); +} +console.log(financial(123.456)); +// expected output: "123.46" +console.log(financial(0.004)); +// expected output: "0.00" +``` + ### Set Set 对象是值的集合,你可以按照插入的顺序迭代它的元素。Set 中的元素只会出现一次,即 Set 中的元素是唯一的。 -- GitLab