Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对象的toString应为'[object Object]'而不是'object' #263

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 04-JavaScript基础/09-数据类型转换.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ console.log(a1.toString()); // "qianguyihao"
console.log(a2.toString()); // "29"
console.log(a3.toString()); // "true"
console.log(a4.toString()); // "1,2,3"
console.log(a5.toString()); // "object"
console.log(a5.toString()); // "[object Object]"

// 下面这两个,打印报错
console.log(a6.toString()); // 报错:Uncaught TypeError: Cannot read properties of null
Expand Down Expand Up @@ -287,7 +287,7 @@ parseInt('5'); // 得到的结果是数字 5

(2)如果字符串不是以数字开头,则转换为 NaN。

(3)如果字符串是一个空串或者是一个全是空格的字符串,转换时会报错
(3)如果字符串是一个空串或者是一个全是空格的字符串,则转换为 NaN

**情况二:Boolean --> 数字**,结果为:NaN

Expand Down