Homework
Javascript For Cats
Read Javascript for Cats.
Gitbook Reading
Read through all of the content of the Gitbook.
Questions?
- Write down any/all questions you have from this week. We'll cover them tomorrow during second pass Friday.
Optional Homework
#1: Arrays
- In your
code/homework/your_name
folder,touch thurs_fun_arrays.js
. - Use a
for
loop, awhile
loop, and another loop of your choice toconsole.log()
each item in the array. - The array to loop through:
var places = ['adler', 'science and industry', 'field museum', 'art institute', 'millenium park', 'river north', 'local 22', 'the L'];
#2: Objects
- In your
code/homework/your_name
folder,touch thurs_fun_objects.js
. - Define an Object that represents your favourite thing in the world.
- Give it 5-10 attributes with values that are not
undefined
ornull
- Use a
for
loop, awhile
loop, and another loop of your choice toconsole.log()
each key and corresponding value in the Object.
Hints
var obj = {
shit: 'stuff',
snakes: 'on a plane',
mushrooms: 'glow',
fallout: 'shelters'
}
for (var item in obj) {
console.log(item + ": " + obj[item]);
}
var arr = ["jack sparrow", "blackbeard", "sinbad"];
for (var index in arr) {
console.log(index + ": " + arr[index]);
}