push data to list javascript code example
Example 1: javscript append item from array
let foo = ['oop','plop','copo'];
foo.push("plop");
Example 2: array.push
var vegetables = ['Capsicum',' Carrot','Cucumber','Onion'];
vegetables.push('Okra');
//expected output ['Capsicum',' Carrot','Cucumber','Onion','Okra'];
// .push adds a thing at the last of an array