The push() method is one of many JavaScript Collection methods that allows appending one or more elements to an array. It modifies the original passed array and returns the new size of the array.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The push() method is one of many JavaScript Collection methods that allows appending one or more elements to an array. It modifies the original passed array and returns the new size of the array.
Syntax:
Example:
Key Points:
This is one of those methods that most people are familiar with, and it is quite easy to implement to add data to the arrays dynamically!
Explore more about Java script Arrays