Reputation: 2752
I am having this following code in notes.js
module.exports.addNote = () => {
console.log('addNote');
return 'New Note';
};
and the app.je
const notes = require('./notes.js');
var res = notes.addNote();
however when i start it it only display the console.log and not the return 'New Note'
> node app.js
addNote
Why is it ?
Upvotes: 1
Views: 23
Reputation: 222484
The function returns a value. It doesn't print a value because you don't do that. If you need to output res
then output it:
const notes = require('./notes.js');
var res = notes.addNote();
console.log(res);
Upvotes: 2