Reputation: 15034
var sys = require("util");
When i try to run this code in the console, i get undefined
as output. Even the below statement while executing throws me undefined.
console.log("Hello World");
Output
Hello World
Undefined
Are we going to create our own server and write code with node.js?
Upvotes: 3
Views: 1241
Reputation: 30073
The last undefined
is result returned from console.log method:
node
> console.log('hey')
hey
undefined
>
As you can see, first 'hey' printed by console.log, but console.log returns undefined as result of operation, and it printed to output.
Upvotes: 7