What is the purpose of module.exports in Node.js?
In Node.JS, module.exports is a special object that is included in every JavaScript file present in the Node.JS file default. Here module is a variable that represents the current module, and export is the object that will be exposed as the module.
Here we export a string from testYourModule.js file
BY Best Interview Question ON 12 Jun 2020
Example
// testYourModule.js
module.exports = "Best Interview Questions provides an example of module.exports"
// index.js
const params = require('./testYourModule.js')
console.log(params )