Learn
Welcome to Codecademy!
Multiple Colors

The text is now displayed in multiple colors! There is a new variable named letterColors with a list of color variables inside brackets ([])separated by commas (,).

letterColors = [red, orange, green, blue, purple];

The displayed text in the browser panel will cycle through the values in letterColors in order when drawName() is called with letterColors.

Learning to code is all about experimentation—trying out new code and observing the result! As you experiment, you may want to reset your code to the starting state. This can be done with the reset button at the bottom of your code editor:

Instructions

1.

Each color is represented by three numbers between []. Try changing numbers, running your code, and observing the result. You can always reset your code if you don’t like the result.

Folder Icon

Take this course for free

Already have an account?