Javascript
Arrays
Summary
We can access an array's items using indices. Arrays have a variety of methods to utilize.
Discussion
var myArray = ["Alex", "Andrew", "James"];
myArray[0]; // this will return "Alex"
// let's assign a new value to "James"
myArray[2] = "Woodstock";
We also covered a lot of methods that each array has. Here are the methods we used.
- pop() - removes and returns the the last item in the array.
- push() - adds an item to the end of the array.
- shift() - removes the first item in an array.
- unshift() - adds an item to the start of the array.
- reverse() - reverses the order of an array.
- sort() - sorts an array by alpha-numerics, based on the first character read.
References
Your references may be placed here. Please place them in an unordered list and add a quick summary of each.