Array#push vs Array[i++] vs Array[array.length]

Edit on GitHub

Setup

var array = []

Tests

  • Array#push

    for (var i = 0; i < 10000; i++) {
      array.push(i)
    }
  • Array[i++]

    var j = 0
    for (var i = 0; i < 10000; i++) {
      array[j++] = i
    }
  • Array[array.length]

    for (var i = 0; i < 10000; i++) {
      array[array.length] = i
    }