how to push number in array code example
Example 1: javascript pushing to an array
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array);
["John", "Sally", "Mike"]
Example 2: js add item to array
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 3: 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 4: how to append objects to javascript lists ?
var studentList = ['Jason', 'Samantha', 'Alice', 'Joseph'];
studentList.push('Jacob');
Example 5: array push
arr.push([element1[, ...[, elementN]]])