Arrays
Review
What is an array?
array = list
an array in the real world?
var singers = ['Beyonce', 'Ariana', 'Britney'];
[
]
Brackets
arrays have elements
var singers = ['Beyonce', 'Ariana', 'Britney'];
elements have an index
var singers = ['Beyonce', 'Ariana', 'Britney'];
0
1
2
index = position
var singers = ['Beyonce', 'Ariana', 'Britney'];
singers[0]; // what is this?
'Beyonce'
var singers = ['Beyonce', 'Ariana', 'Britney'];
singers.length // what is this?
length = size
3
practice in jsbin
console.log()
~ alert()
alert()

console.log()

console.log("Beyonce");

alert("Beyonce");

Exercises!
4444.io#34
Homework
1. Finish all the exercises at http://4444.io#34
2. Email your code to Alex (alexandraqin@gmail.com)
3. Finish the Codecademy lesson on arrays
Exit Ticket
What will these lines of code print?
var catSounds = [‘purr’, ‘meow’, ‘scratch’, ‘woof’, ‘i like milk’];
1. console.log(catSounds.length);
2. console.log(catSounds[1]);
3. console.log(catSounds[5]);
Arrays
By Alexandra Qin
Arrays
- 313