Typeof found an interesting problem.

typeof of js

typeof Number("1") === "number"  //true
typeof Number("1") === "number"  //true
typeof Number("") === "number"  //false

Why

Sep.10,2021

Number ("1 ah") / / NaN

typeof NaN = 'number'

so: typeof Number ("1") = "number" / / true


cast to a number, there is no conversion failure, so your result appears, typeof Number ("ah") = 'number' should be true.


all three on my side are true


who told you typeof Number ("ah") = "number" is fasle ?
because the cast results of the following two types are NAN , so it is true .
< H1 > the answer is true < / H1 >

can't reproduce your problem?


trueNumberNaN

clipboard.png


for typeof Number ("1 ah") = "number" / / true is right e
but typeof Number ("ah") = "number" / / false how to explain it? does anyone know

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b1df-407f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b1df-407f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?