I've been programming JS for a bunch of years and I am still finding new shortcuts for doing things. I am wondering if there are more that I do not know about.
Here are the shortcuts I know about:
edit: I agree that you should generally never do this stuff, and that there could be a better way to describe it as to be less broad, but the best I can do is describe it by example.
Instead of this
if("foobar".indexOf("foo") > -1)
Do this
if(~"foobar".indexOf("foo"))
Instead of this
var foo = Math.floor(2.333)
Do this
var foo = ~~2.333
Instead of this
var foo = parseFloat("12.4")
var bar = parseInt("12", 10)
Do this (not huge fan of this one )
var foo = +"12.4"
var bar = +"12"
Instead of this
if(isNaN(foo)
Do this
if(foo != foo)
Instead of this
(function(){ ... })()
Do this
!function(){ ... }()
Convert anything to a boolean by prefixing it with !!
var isFoo = !!foo
There you have it, my list of things to never do to your coworkers.
Can anything else be added here?