add new number in a list JS code example
Example 1: javascript append element to array
var colors= ["red","blue"];
colors.push("yellow");
Example 2: javascript adding an array to an array
let chocholates = ['Mars', 'BarOne', 'Tex'];
let chips = ['Doritos', 'Lays', 'Simba'];
let sweets = ['JellyTots'];
let snacks = [];
snacks.concat(chocholates);
snacks.concat(chocolates, chips, sweets);
Example 3: javascript append array to end of array
const new_array = old_array.concat([value1[, value2[, ...[, valueN]]]])