The Intro to Variables tutorial introduces the ideas of incorporating variables in the Intro to JS: Drawing & Animation programming method.

Intro to Variables Edit

In this tutorial [1], the user learns how variables can "hold on to" a value, such as a parameter or color, until used later again in the script. For example, var eyeSize (as shown in the screenshot) can be defined, and then have a value assigned to it, such as var eyeSize = 3. Winston's eyeSize is actually the example in this coding talk through.

The syntax to defining variables is:

var x = value;

A value can be assigned to any given previously stated variable by defining it on the right side of the equal sign. The user can, for example, assign a color or (pixel) value to a variable.



Jessica explains how to define and use variables.

var eyeSize = 33;


var eyeColor = color(0, 0, 0); (rgb value)

External SourcesEdit

☀ All Khan Academy content is available for free at: