1var colors=["red","blue"];
2var index=1;
3
4//insert "white" at index 1
5colors.splice(index, 0, "white"); //colors = ["red", "white", "blue"]
6
1//adding items to array
2objects = [];
3objects.push("you can add a string,number,boolean,etc");
4//if you more stuff in a array
5//before i made a error doing value = : value
6objects.push({variable1 : value, variable2 : value);
7//we do the {} so we tell it it will have more stuff and the variable : value
8
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