0

As I understand

b && "" !== b && (a[b] = this);

is just the same as

if(b && "" !== b) a[b] = this;

Are these syntax forms equivalent?

Tripp Kinetics
  • 5,178
  • 2
  • 23
  • 37
zavg
  • 10,351
  • 4
  • 44
  • 67
  • 2
    Yes. However, the `if` statement is easier to understand. – Felix Kling Jul 02 '14 at 16:24
  • 1
    simple note : if you are using if(b) it will check for three conditions - whether b is null or undefined or empyt i.e "" and if it is boolean it checks for true or false – Bharath Jul 02 '14 at 16:30
  • 1
    exact duplicate of [Is && statement() the same as if() statement()?](http://stackoverflow.com/q/12664230/1048572) @FelixKling could you close it? – Bergi Jul 02 '14 at 16:32

0 Answers0