How to combine two JavaScript statements into one


Sometimes I want to combine two statements into one to omit curly braces in conditionals. For example, in PHP, instead of writing

if ($direction == 'south-east') {

I would write

if ($direction == 'south-east') $x++ and $y++;

but is there a way to do that in JavaScript? Writing x++ && y++ doesn't seem to work.

Curly braces aren't that bad, but - in very specific cases - you can enhance your code by using commas:

if ( direction == 'south-east' ) x++, y++;

Here's the fiddle: