面试题

mac2022-07-05  8

https://segmentfault.com/a/1190000015383749

1.

console.log(typeof []) //"object" console.log(typeof typeof []) //=》typeof "object" //"string"

因为typeof返回结果都是字符串

2.

<script type="text/javascript"> var num = parseInt('width:35.5px'); if (num == 35.5) { alert(0) } else if (num == 35) { alert(1) } else if (num == NaN) { alert(2) } else if (typeof num == 'number') { alert(3) } else { alert(4) } console.log(typeof num)//number console.log(typeof num == 'number')//true //3 </script>

 

转载于:https://www.cnblogs.com/huanghuali/p/9359071.html

最新回复(0)