Quickie: shortened "for" and "if"
If
Today after debugging minified JS code I discovered an interesting way to write ifs:
var i = 0;
var s = 'foo';
if (s === 'bar') {
i = 1;
}
can also be written:
var i = 0;
var s = 'foo';
(s === 'bar') && (i = 1);
For
Shorthand for for cycle. Not that you should use it like this.
for (var $i = 0, $j = 0; $i < 3, $j < 4; console.log($i * $j), $j+=2, $i++ );