18 Arrays Intro

What are arrays?

Vocabulary: array, index, element, zero-indexed

Activity:


1. Draw a simple building made of rectangles with at least three floors. Give each floor a different primary color.

2. [Wait for instructions.]  Let's build an array.

arrayIndex
var colors=['red', 'blue', 'green', 'yellow', 'orange']

colors[0] //red
colors[1] //blue
// and so on

3. Modify the building code to use an array for color specification.

4. Use RGB color values instead of text values like 'blue', ' green'. SUBMIT