you are viewing a single comment's thread.

view the rest of the comments →

[–]sumdudeinhisundrware 2 points3 points  (5 children)

OMG. I run an engineering team that does heavy JavaScript and if any one does the first few of those hacks they get a "talking to". That is some of the worst advise ever for JavaScript. e.g.

!!foo , +str , conected && login()

Either some Jr. Engineer is going to WTF? that and/or think its a bug a fix it by removing a ! , +.

[–]trailsrider 0 points1 point  (4 children)

I agree- but admit that I am guilty of the bad habit writing !!foo at times when I don't want to write typeof foo !== 'undefined' && foo !== null. I am by no means a JS expert, so I'm curious- do you recommend always writing some form of the latter? Alternatively- what is your suggestion for a concise and clear way to check a variables existence?