Array.prototype.pushintermediateconst arr = ['a', 'b']
const newLength = arr.push('c') // β 3
arr // β ['a', 'b', 'c']push() returns the new length of the array, which you can use without a separate length check.
Unlike many array methods, push() returns the new length of the array β not the element added, not the array itself.
const len = [1, 2].push(3) // len === 3
This is a common source of bugs when developers expect it to return the pushed element.