Within your function, you are converting the value assigned to planet to lowercase.
But, in your conditions, you are comparing this lowercase string with strings such as "Mercury" and "Jupiter".
Since a lowercase string will never match these strings, so none of the conditions is true and you exit the function without reaching any explicit return and therefore implicitly return undefined.
You could edit your conditions so that you are comparing the lowercase string to "mercury" and "jupiter" instead of "Mercury" and "Jupiter".