for-in without property check vs for-in with property check

Edit on GitHub

Setup

Tests

  • for-in without property check

    var y = {'a': 1, 'b': 2, 'c': 3};
    var j;
    for (var i in y) {
        j++;
    }
  • for-in with property check

    var y = {'a': 1, 'b': 2, 'c': 3};
    var j;
    for (var i in y) {
        if (!y.hasOwnProperty(i)) continue;
        j++;
    }