JS tablica Dodaj element
array.push(element)
Common Mynah
array.push(element)
Array.prototype.insert = function ( index, item ) {
this.splice( index, 0, item );
};
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
let dailyActivities = ['eat', 'sleep'];
// add an element at the end
dailyActivities.push('exercise');
console.log(dailyActivities); // ['eat', 'sleep', 'exercise']
array.push(...otherArray)
var fruits = ["Orange", "Apple", "Mango"];
var moreFruits = ["Banana", "Lemon", "Kiwi"];
fruits.push(...moreFruits);
//fruits => ["Orange", "Apple", "Mango", "Banana", "Lemon", "Kiwi"]