Search code examples
javascriptnode.jsconsoleundefined

node.js displays "undefined" on the console


Recently I installed node.js on my Windows 7 machine.

On execution of JavaScript, I get an undefined message along with successful execution of the expression.

What's wrong here? I have not noticed any other side effects.

enter image description here


Solution

  • Just write "hello world"; and hit enter... it will return "hello world" instead of undefined, thus no undefined is displayed. console.log returns undefined and also logs arguments to console so you get multiple messages.