-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.js
More file actions
19 lines (19 loc) · 715 Bytes
/
array.js
File metadata and controls
19 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var people = ["Alice", "Brandon", "Cindy", "Debbie", "Ernie"];
var ages = [32, 43, 54, 65,76]
var inDenver = [true, false, true, false, true]
console.log(people)
console.log(ages)
console.log(inDenver)
//This will remove the last element ("Ernie") from the array
people.pop()
console.log(people)
//This will remove the first element (32) from the array
ages.shift()
console.log(ages)
//This would add new elements to the end of the array, but I don't have any to add so it won't do anything
inDenver.push()
console.log(inDenver)
//This will call the second index position from the people array (Brandon)
console.log(people[1])
//This will call the third index position from the ages array (65)
console.log(ages[2])