1const array1 = ['a', 'b', 'c'];
2const array2 = ['d', 'e', 'f'];
3const array3 = array1.concat(array2);
1// for me lol... pls don't delete!
2// use splice to insert element
3// arr.splice(index, numItemsToDelete, item);
4var list = ["hello", "world"];
5list.splice( 1, 0, "bye");
6//result
7["hello", "bye", "world"]
8
1Array.prototype.insert = function ( index, item ) {
2 this.splice( index, 0, item );
3};
1
2let chocholates = ['Mars', 'BarOne', 'Tex'];
3let chips = ['Doritos', 'Lays', 'Simba'];
4let sweets = ['JellyTots'];
5
6let snacks = [];
7snacks.concat(chocholates);
8// snacks will now be ['Mars', 'BarOne', 'Tex']
9// Similarly if we left the snacks array empty and used the following
10snacks.concat(chocolates, chips, sweets);
11//This would return the snacks array with all other arrays combined together
12// ['Mars', 'BarOne', 'Tex', 'Doritos', 'Lays', 'Simba', 'JellyTots']
13
1var arr1 = ["Hello"," "];
2var arr2 = ["World","!"];
3var both = arr1.concat(arr2);
4//both = ["Hello"," ","World","!"];