Common state action is to add or remove items from an array or to add or remove fields from an object. Note: The new item(s) will be added at the end of the array. Adding arrays in JavaScript is nothing but the appending arrays, which is generally called as JavaScript array append. Push Method - This method adds the new elements to the end of an array. To add an object at the first position, use Array.unshift. Examples might be simplified to improve reading and learning. Code:

You can click the button to add a new subject mathematics in the subjects array.