This forum is now read-only. Please use our new forums at

Animate Your Name Forum

View Course

21 points
Submitted by
almost 4 years ago

I want to understand why "red" doesn't work

i just wanted to understand that in the syntax given below:
var letterColors=["red",green,blue,purple];
it hides the red color in the name.
how it is doing that.?? i did not get the logic behind that.

0 votes


Let's see if I can explain this.

There are different types of data.

One type is a string. Strings are indicated by putting quotes around text, like "red".

Another type is an array. Arrays are groups of data. Arrays are indicated by putting square brackets around the data, like [0, 100, 63]. We can give arrays a name, like red = [0, 100, 63]

In the first case, "red" just means those 3 characters, in the second case, red represents that array with three numbers. Those numbers can be used to tell the computer how to create the colour that we know as red.

So in your example letterColors = ["red", green, blue, purple], the "red" can not be converted to a colour because it is just those three letters, so you no longer see red in your animation.

3698 points
Submitted by
almost 4 years ago

0 votes


Try the next and your code it will be fixed it:
var letterColors = [red, orange, green, blue, purple];

365 points
Submitted by
Tobias Páez
over 3 years ago