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

smsprefeiturasp - Phishing campaign

  Original Email Original Links http://smsprefeiturasp.org/  https://listserver.slu.se/scripts/wa.exe https://listserver.slu.se/scripts/wa.e...