Help with function that calculates average color

Can someone please help me out on this question please?

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.

@camperextraordinaire no problem. This is how far I’ve gotten I don’t know if am correct or not:
MY SOLUTION BELOW:

function colorFind(rgb(255,0,0), rgb(0,255,0)){
red.sort(function(a,b){
return a-b;
});
for(var a=0; a < red.length; a++){
if(rgb(255,0,0)[a] >= rgb(0,255,0))
return a;
}
return red;
}
colorFind(rgb(255,0,0), rgb(0,255,0), rgb(0,0,255));

This second solution is quite abit complex than the first… Tell me @camperextraordinaire what’s the best way I can get to really improve on the way to approach algorithm challenges and also atleast be good at them now that am focusing mostly on Javascript. Am asking you because you seem to be experienced and somehow a teacher

This is very helpful I’ll start using this method when solving a problem. I definitely think it’s a good way to start with when you’re faced with a challenge. Thanks a lot for breaking it down for me.