Preview:
Single value exports
people.js
const people = ['Yash', 'Karan', 'Kuldeep', 'Sony'];
module.exports = people

global.js
const xyz = require('./people');
console.log(xyz);

----------------------------------------------------------

Multiple value exports
people.js
const people = ['Yash', 'Karan', 'Kuldeep', 'Sony'];
const ages = [20, 30, 40, 50];
module.exports = {
    people,
    ages
}

global.js
const xyz = require('./people');
console.log(xyz.people, xyz.ages);

---------------------------------------------------------

Destructuring
global.js
const {people, ages} = require('./people');
console.log(people, ages);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter