This is a question from coderbyte’s easy set. Many people asked about it already, but I’m really curious about what’s wrong with my particular solution (I know it’s a pretty
I think the problem is that you're placing the return statement inside your outermost loop. It should be inside your inner loop.
return
So you have to place the return statement within the inner loop.
if (countNew > count) { count = countNew; word = arr[i]; } return word; } } }