const vegetables = ['parsnip', 'potato'];
const moreVegs = ['celery', 'beetroot'];
// Merge the second array into the first one
vegetables.push(...moreVegs);
console.log(vegetables); // ['parsnip', 'potato', 'celery', 'beetroot']
let array = ["A", "B"];
let variable = "what you want to add";
//Add the variable to the end of the array
array.push(variable);
//===========================
console.log(array);
//output =>
//["A", "B", "what you want to add"]
//the array comes here
var numbers = [1, 2, 3, 4];
//here you add another number
numbers.push(5);
//or if you want to do it with words
var words = ["one", "two", "three", "four"];
//then you add a word
words.push("five")
//thanks for reading
// Add to the end of array
let colors = ["white","blue"];
colors.push("red");
// ['white','blue','red']
// Add to the beggining of array
let colors = ["white","blue"];
colors.unshift("red");
// ['red','white','blue']
// Adding with spread operator
let colors = ["white","blue"];
colors = [...colors, "red"];
// ['white','blue','red']