INSTRUCTIONS
Write a function that takes 2 colors as arguments and returns the average color.
- The parameters will be two 6-digit hexadecimal strings. This does not need to be validated.
- The return value should be a 6-digit hexadecimal string.
- The hexadecimal strings represent colors in RGB, much like in CSS.
- The average color is to be determined by taking the arithmetic mean for each component: red, green and blue.
CODE
const avgColor = (str1, str2) => {
return (str1 + str2) / 2
}
QUESTION
Hexadecimal is something like this 0000ff
right?
I'm not sure what it means when I need to take the arithmetic mean for each component and lists 3 colors. How do you take an average of strings?