特殊类型 调用Number函数

// 特殊类型 null
a = null;
a = Number(a);

console.log("null a转换后类型 = " + typeof a);
console.log("null a转换后的值 = " + a);

// 特殊类型 undefined
a = undefined;
a = Number(a);

console.log("undefined a转换后类型 = " + typeof a);
console.log("undefined a转换后的值 = " + a);

 

posted @ 2023-07-14 09:28  青老师  阅读(3)  评论(0编辑  收藏  举报