Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSD 340 (Blum)1 Arrays See Beginning JavaScript pp. 51-57.

Similar presentations


Presentation on theme: "CSD 340 (Blum)1 Arrays See Beginning JavaScript pp. 51-57."— Presentation transcript:

1 CSD 340 (Blum)1 Arrays See Beginning JavaScript pp. 51-57

2 CSD 340 (Blum)2 State Capital array example

3 CSD 340 (Blum)3 Result of state capital example

4 CSD 340 (Blum)4 Declare, instantiate, initialize Recall that regular variables like i has to be declared (using the keyword “var”) and possibly initialized (you might set it equal to some value). Arrays additionally need to be “instantiated.” Hence the appearance of the keyword “new”.

5 CSD 340 (Blum)5 Some vocabulary When you “instantiate” it means that there is a pre-existing template for the thing you are making known as a “class.” You use the template to make your thing which is called an “object.” Free stuff: the class will typically have various “properties” and “methods” that you can use and you do not have to code yourself.

6 CSD 340 (Blum)6 Arrays in loops Because the code for each color is essentially the same, we can place it inside a loop to achieve this repetition. Each individual element of the array is referred to by using the name of the array and an index. Indices start at zero. Get used to it!

7 CSD 340 (Blum)7 Array Redo Of Quote Quiz

8 CSD 340 (Blum)8

9 9 Redo2

10 CSD 340 (Blum)10

11 CSD 340 (Blum)11


Download ppt "CSD 340 (Blum)1 Arrays See Beginning JavaScript pp. 51-57."

Similar presentations


Ads by Google