Why…

```
**if (a || b <0) {**
**return undefined;**
**}**
```

does not work the same as:

```
**if (a < 0 || b < 0) {**
** return undefined;**
**}**
```

Return Early Pattern for Functions, what's different?

0

Why…

```
**if (a || b <0) {**
**return undefined;**
**}**
```

does not work the same as:

```
**if (a < 0 || b < 0) {**
** return undefined;**
**}**
```

Welcome!

`if(a) return undefiend`

What values for `a`

are truthy?

truthy?

a < 0 || b <0 vs a || b <0

is it the same meaning?

let `a=1`

`false`

(depending on `b`

)

`true`

(doesn’t matter what `b`

is)

What values for `a`

result in `false`

when you just have if(a)?

1 Like

Thanks a lot!

a || b < 0;

just requires a to be true to carry on with…

=)

1 Like