Sandeep G B Sandeep G B - 5 months ago 10
Node.js Question

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

Answer

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.

Comments