Avoid Array.prototype.push. It modifies the array in place, which is asking for trouble. It also returns the array length, not the modified array, which is plain confusing.

Instead, prefer the array spread syntax1.

const original = ['cat', 'sat']
const modified = [...original, 'mat']

If you need to go old school, there’s Array.prototype.concat.

const original = ['cat', 'sat']
const modified = original.concat(['mat'])

  1. Unless you’re dealing with a massive array, where memory usage is an issue. ↩︎