garote: (machine)
[personal profile] garote
''        ==   '0'           // false
0         ==   ''            // true
0         ==   '0'           // true
!0        ==   true          // true
!1        ==   false         // true
false     ==   'false'       // false
false     ==   '0'           // true
false     ==   undefined     // false
false     ==   null          // false
null      ==   undefined     // true
" \t\r\n" ==   0             // true
NaN       ===  NaN           // false
!!NaN     ===  !!NaN         // true
I recently saw someone prefacing their code with
var t=!0;
... Because they wanted to save space in their code by replacing every occurrence of true with t, and also wanted so save two bytes while declaring what t was.

And I thought Perl invited abuse!

If you see anyone doing this, pour your drink on their head.

Profile

garote: (Default)
garote

July 2025

S M T W T F S
   12 345
6789101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Page Summary

Page generated Jul. 4th, 2025 05:14 pm