var filename = get_filename_or_something() ; # !important
if ( !! filename ) {
# do code
}
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