Simple if vs Not undefined

Edit on GitHub

Setup

Tests

  • Simple if

    var a = {a: 1};
    var b = 2;
    if (a) {
     b = 3;
    }
  • Not undefined

    var a = {a: 1};
    var b = 2;
    if (a !== undefined) {
     b = 3;
    }