! 0 what is the advantage of writing this way?

! 0 what is the advantage of writing this way? Will there be any performance difference?

and ! 0! 1!-1 like this, are there many fewer letters than writing true and false directly? This saves traffic (lll "")?

May.24,2021

!0                => 0  => true
!=1 or !=-1       => indexOfnumber
!!0               => 0   => false


if(){}else if(){} => ?:()


 *!0*



 
console.time()
//code
console.timeEnd();

! 1 and!-1 are both concrete examples of the way x is written, and do a "non" operation on x. This is a basic way to write a Boolean operation, and the values of 1 and-1 are true, so! 1 and!-1 are equivalent to false.. The code compression (uglifyjs) tool will use this technique to reduce code size. Please note, however, that no one will use this method to replace false. in handwritten source code.

!! X is a common way to write (vue), which exists in many well-known projects. The function is type conversion, converting x to the corresponding Boolean value.


you can see that the minimized JavaScript code is written in this way, and a lot of true or false also takes up a lot of space and needs to be saved in all aspects.


js compression. Zsbd


to be honest, I don't think it is necessary to write this way to increase the cost of learning, and it is not necessary to


compile time. Uglify compression should be like this in the end.

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