From dd6073e3b36982e436c81f6b29bdbf61f6af87bb Mon Sep 17 00:00:00 2001 From: hello-chinese <841030329@qq.com> Date: Wed, 23 Dec 2020 17:28:53 +0800 Subject: [PATCH] fix: update datatype.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文案错误: type为number,调用完valueOf,得到不是原始值,应该是进行第二步。 --- docs/webframe/javascript/datatype.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/webframe/javascript/datatype.md b/docs/webframe/javascript/datatype.md index e2ce175..54c6e4d 100644 --- a/docs/webframe/javascript/datatype.md +++ b/docs/webframe/javascript/datatype.md @@ -320,7 +320,7 @@ console.log('2'+obj1); 对下面`'2'+obj2`详细举例说明如下: 1. 左边为`string`,`ToPrimitive`原始值转换后不发生变化 -2. 右边转化时同样按照`ToPrimitive`进行原始值转换,由于指定的type是`number`,进行`ToPrimitive`转化调用`obj2.valueof()`,得到的不是原始值,进行第三步 +2. 右边转化时同样按照`ToPrimitive`进行原始值转换,由于指定的type是`number`,进行`ToPrimitive`转化调用`obj2.valueof()`,得到的不是原始值,进行第二步 3. 调用`toString()` ` return 'a'` 4. 符号两边存在`string`,而且是`+`号运算符则都采用`String`规则转换为`string`类型进行拼接 5. 输出结果`2a` @@ -599,4 +599,4 @@ undefined + 1 // NaN // null console.log(String(undefined)); // undefined - ``` \ No newline at end of file + ```