(Not sponsored, but if you want to give me free coffee....)
var coffee = "Pumpkin Spice Latte";
var coffee = "Pumpkin Spice Latte"; // Index: 0123456789012345678 // 111111111
coffee.length
A) 0
B) 1
C) 2
D) 18
E) 19
coffee[2]
A) "p"
B) "u"
C) "m"
D) "k"
E) "i"
__________________ == "c"
A) 10
B) 11
C) 12
D) 13
E) 14
var b10 = ["UIUC", "IU", "Iowa", "UMD", "UMich", "MSU", "Minnesota", "Nebraska", "Northwestern", "OSU", "Penn State", "Purdue", "Rutgers" ];
b10.length
A) 10
B) 11
C) 12
D) 13
E) 14
b10[2]
A) "UIUC"
B) "IU"
C) "Iowa"
D) "UMD"
E) "UMish"
_______________ == "Purdue"
A) b10[10]
B) b10[11]
C) b10[12]
D) b10[13]
E) b10[14]
b10[0] == _______________________
b10[0].length
A) 1
B) 2
C) 3
D) 4
E) 5
b10[0][1]
A) "U"
B) "I"
C) "C"
D) "UIUC"
E) "UIC"
var count = 0; for (var i = 0; i < b10.length; i++) { var b10school = b10[i]; if (b10school[0] == "U") { count = count + 1; } }
"UIUC #1!" "Boo Iowa!" "Boo IU!"
var b10meme = function (school) { ... }
New data type: object
Objects allow us to assoicate data in a dictionary.
Imagine a wade object in a computer, it will have several properties about it. We call these key-value pairs:
name: "Wade" netId: "waf" office: "2215 SC"
We can define wade:
var wade = { name: "Wade", netId: "waf", office: "2215 SC" };
We can refer to wade using the dot operator:
wade.name wade.netId wade.office
HTML is HyperText Markup Language
<html> <head> <title>CS 105</title> </head> <body> <div> Hello, world! </div> </body> </html>
<div class="cs105" onclick="jsFunction();"> ... </div>
<div class="cs105" onclick="jsFunction();" id="cs105div"> ... </div>
var e = document.getElementById("cs105div");