Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2011/09/29

Learned some Javascript (and maybe more) (I think)

  1. var filename = get_filename_or_something() ; # !important  
  2. if ( !! filename ) {  
  3.     # do code  
  4.     }  
It took me a while, but I think I get this. If you try this and filename is undefined, that could be a problem. One bang forces it into the logical realm, and the other bang reverses it, making positives negatives. In perl, we'd just go if ( $filename ) {} , but we're cool like that.

But, as you might imagine, it is absolutely impossible to look this one up on Google.

No comments:

Post a Comment