javascript añadir a la matriz
var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
js array añadir elemento
array.push(element)
js añadir elemento a la matriz
var fruits = [ "Orange", "Apple", "Mango"];
fruits.push("Banana");
javascript array añadir
// example:
let yourArray = [1, 2, 3];
yourArray.push(4); // yourArray = [1, 2, 3, 4]
// syntax:
// <array-name>.push(<value-to-add>);
js añadir función a la matriz
//create an new function that can be used by any array
Array.prototype.second = function() {
return this[1];
};
var myArray = ["item1","item2","item3"];
console.log(myArray.second());//returns 'item2'