How to append an item to an array in Javascript

The standard way to append an item to an array is to use Array.push (opens new window). The method push() allows you to append one or multiple items to an array. In addition, you can also use Array.concat (opens new window) to append one array to another array.

Copy code

One thing to note about concat() is that it doesn't modify the arrays you provide, it creates a new array with the concatenated values.

Join our community

Your sign-up could not be saved. Please try again.
Your sign-up was successful.

Sign-up and get tips to becoming a software engineer.