What is the difference between module.exports and exports in node.js?



What is the difference between module.exports and exports in node.js?..

Answer / Vandana Sharma

In Node.js, `module.exports` and `exports` refer to the same object. However, it's common to use the shortcut `exports`. When you assign a value to `module.exports`, you are effectively changing the object that `exports` refers to.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Node.js Interview Questions

What is middleware in node.js?

1 Answers  


What is promisify?

1 Answers  


How Grunt and Gulp deal with Task Automation?

1 Answers  


Explain the concept of stub in node.js.

1 Answers  


How to run multiple node js files?

1 Answers  


Why is yarn better than npm?

1 Answers  


How node.js and javascript are related?

1 Answers  


How to create a module in node js?

1 Answers  


How to create a class in node js?

1 Answers  


What’s the difference between ‘front-end’ and ‘back-end’ development?

1 Answers  


What are the various options to download the version of a node module?

1 Answers  


Since node is a single threaded process, how to make use of all cpus?

1 Answers  


Categories