Amandeep Pasricha14,928 Points
So why isn't it that we needed a specific color for red, blue, and green?
Essentially, I am asking conceptually why he felt the need to remove the red, green, and blue variables at the end. I just would have thought he would have wanted a colour value defined specifically for each.
Eric McKibbinTreehouse Moderator 11,441 Points
blue variables were originally just used as placeholders for random numbers. Then those numbers were concatenated together into the
The generation of the value for the
rbgColor variable was later replaced with the
randomColor() function, which returns this concatenated value. So the
rbgColor variable no longer got its value from the
blue variables. As such, they did nothing.
There's also the fact that if there is a variable called
red in code, many people will expect it to relate to the colour red. e.g.
rgb(255,0,0) or hex of
#FF0000. Some people might not expect it to be the first portion of an rbg value (although it was somewhat obvious in this case).
The short answer is, those variables were removed because their values were no longer used!