Java Script: is this system error?


What should I do to pass this exam? Why does it tell me to return "undefined"?


It doesn't want you to return undefined. I guess all these exercises have the same test function that expects either a working output or no output at all (case doesn't exist yet). So as you're code produces an output it expects that it is the correct one. Mostly this error message gives you the test cases for the error so in your case scissors and rock. And if you follow the cases you end up at undefined where rock should have won.

Also rather post code (+error message) instead of screenshots that makes it easier to run it.

PS: And maybe have a look at this for the origin of else if:

it works to use else{ if
but you can save many levels of nesting by just using else if and else if is in the end nothing other than nesting.