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: 
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'").
The result of the boolean expression sometimes can be evaluated without evaluating all the sub-expressions. If we have `A||B`, and `A` is true there's no need to even evaluate `B`, because the result will be true anyway. This behavior is called "shortcut boolean evaluation" and is defacto standard in most programming languages. It allows to write expressions like `if (i < A.length && A[i] == ...)` without evaluating the `A[i]` operand which can lead to an exception if `i` value is incorrect.

In this particular case, `!a||b` is the same as `if(a)b`, yes, but the readability and maintainability of such code is a question though.