If you want to return a value other than
undefined from a function then you always need to
return (for single line arrow functions the
return is implied). All of the solutions for these two challenges use
return to return a value.
I think you are referring to the fact that one of the solutions uses
return in the
switch block for every
case while the other sets
answer to the return value in the
switch and then returns
answer after the
switch. They are both correct, you can do either.
Although I will note that the solution that returns for each
case doesn’t need the
break after each
return and doesn’t need the
return at the very end and doesn’t need the
answer variable at the beginning.
Personally, for simple functions like these I would just return after each