Question: I found a way to write the `if` statement in another way (I think) while searching in the source code of a website.

Instead of:

```
if(a)b;

```

or:

```
a?b:'';

```

I read:

```
!a||b;

```

Is the third way the same as the first two? And if yes, why we would use the third way?

Answer: 
The third way is the same as the previous ones. One argument to use it is saving bytes. A strong argument against using it is readability. You'd better focus on readability in writing code, and use a minimizer (such as [Google Closure Compiler](http://closure-compiler.appspot.com)) to save bytes.

It can be even shorter:

```
a && b;
/*  !a||b  means:
 (not a) OR b
    which is equivalent to
 a AND b
    which turns out to be
 a && b
*/

```
Welcome to the concept of [short-circuit evaluation](https://developer.mozilla.org/en/JavaScript/Reference/Operators/Logical_Operators). This is well known property of logical operators, employed in different languages. Most often this'll be used as subexpression inside proper `if` or any other flow control statement, or to express condition short enough so it retains readability in this way, or by automatic transformation to save bytes.

There's even tag for question regarding those: [short-circuiting](/questions/tagged/short-circuiting "show questions tagged 'short-circuiting'").