1. Creating an array
const Fruits = ["Apple", "Orange", "banana"]; const Vegitables = ["Onion", "Tomato", "Beans", "Potato"];
2. Merging two arrays
To merge the two lists of array values, we need to use “concat()” method in . Concat() returns a new array by concatenating/appending given element(s) to the elements of the given array.
…args = indicates elements to be concatenated/appended
const shop = Fruits.concat(Vegitables); document.write(shop);
Here, I merged the Fruits and Vegetables array using concat() method and store it as “shop” variable.
Then printed the “shop”. See the output, the two arrays is merged and displayed.