This commit is contained in:
cyan0714 2024-03-03 09:11:06 -08:00 committed by GitHub
commit 3ec3c0019b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -101,7 +101,7 @@ console.log(a1.toString()); // "qianguyihao"
console.log(a2.toString()); // "29" console.log(a2.toString()); // "29"
console.log(a3.toString()); // "true" console.log(a3.toString()); // "true"
console.log(a4.toString()); // "1,2,3" 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 console.log(a6.toString()); // 报错Uncaught TypeError: Cannot read properties of null
@ -299,7 +299,7 @@ parseInt('5'); // 得到的结果是数字 5
2如果字符串不是以数字开头则转换为 NaN。 2如果字符串不是以数字开头则转换为 NaN。
3如果字符串是一个空串或者是一个全是空格的字符串转换时会报错 3如果字符串是一个空串或者是一个全是空格的字符串则转换为 NaN
**情况二Boolean --> 数字**结果为NaN **情况二Boolean --> 数字**结果为NaN