Why is + 1 in js fasle?

! + 1 / / false
what is the principle

Aug.25,2021

+ and ! are unary operators. First + gets 1 and then ! gets false


you can refer to the operator priority problem. Logic does not take a value that is originally true as false


.

for ! + 1 , where + is here as the unary plus sign (+) , calculates the value of the following Operand, and attempts to convert it to a numeric value. For example, + 1 = > 1 , +'1' = > 1 . Logic is not! only determines whether the subsequent Operand is true. The false values of are: null,undefined,false,NaN,0,-0,+0 . The priority of
unary addition is 16, and the priority of logical non is 16, but their relevance is from right to left, so here + 1 is true , and logical non! is followed by false .

refer to priority summary


Logic in mathematics. Not only! + 1, any string you can get is false. ! 0 = true,! 1 = false


must be false!


clipboard.png


is equivalent to! (1), of course it is false


! Is to reverse the Boolean value
! ture==false
! false==true
Boolean (1) = true
Boolean (+ 1) = true
! true is naturally equal to false


false


arithmetic operator
logical operator

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