append to an array code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");
Example 2: javascript pushing to an array
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array);
["John", "Sally", "Mike"]
Example 3: javascript append list
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 4: append item to array javascript
arr.push(item);
Example 5: how to push values in array
const animals = ['pigs', 'goats', 'sheep'];
const count = animals.push('cows');
console.log(count);
console.log(animals);
animals.push('chickens', 'cats', 'dogs');
console.log(animals);
Example 6: javascript append array to end of array
const new_array = old_array.concat([value1[, value2[, ...[, valueN]]]])