Sunday, May 6, 2018

myArray.push and splice

// JavaScript Document

// Creating an array
var myArray = ["Doug", "Mike", "Janet", "Matt"];
console.log(myArray);

// Adding an item to the array
myArray.push("Pat");
console.log(myArray);

// Changing an item in the array
myArray[0] = "Tim";
console.log(myArray);

// Removing items from an array
myArray.splice(1,2);
console.log(myArray);

No comments:

Post a Comment

Spatial Epidemiology of Agrochemical Exposures and Chronic Pathologies: A Multidimensional Analysis of Pesticide Use, Oncological Trends, and Parkinsonian Clusters in the United States

The relationship between the large-scale application of synthetic chemicals and the incidence of chronic, life-altering diseases represents ...