Javascript typeof

var str= "123abc";
alert (typeof (strPP)); / / number
alert (str); / / NaN / / Why is this equal to NaN? what exactly does the above strPP do? it is different from str+1

Mar.29,2021

str+1 returns the string "str1"

strPP first executes Number (str), and the result is NAN. And then do the + 1 operation. It is important to note that NAN is also of type number.

so if str= "123", strPP return value (Number ("123") is 123, strvalue is 124.


I'll talk about the execution process

var str= "123abc";
alert (typeof (strPP)); / / number
alert (str); / / NaN / / Why is this equal to NaN? what exactly does the above strPP do is different from str+1

alert (typeof (strPP));
execute as follows:

  1. Number (str) = > NaN
  2. typeof (NaN) = > number
  3. strPP = > NaN
  4. alert ("number") = > number
  5. alert (str) = > alert (NaN)

the second case
str+1 is string concatenation. You should know the rest.

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-1eaef39-2218.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-1eaef39-2218.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?