Nothing is wrong with it... If you're not seeing an output it's probably because you're not executing it correctly.
You need to select the code with the mouse before running it. Otherwise it will only execute the line the cursor is on.
A common misconception is that “undefined” is an error message. That’s not the case, it just means that your code did not return anything. In this case, it is actually an indication that something did run, just not the portion of the code you wanted to execute.