Why is my javascript array push method not returning the updated array?

In JavaScript, the `push` method on an array returns the new length of the array after the element has been added, not the updated array itself. Example:

let nums = [1, 2, 3];
let result = nums.push(4);
console.log(result);  // 4
Solution:

let nums = [1, 2, 3];
nums.push(4);
console.log(nums);  // [1, 2, 3, 4]
Ensure to reference the array directly after using `push` if you want to see the updated content.

Beginner's Guide to JavaScript