Module file
file name - operator.js
module.exports = {add, sub , name};
const add = (a, b)=>{
return a +b ;
}
const sub = (a, b)=>{
return a - b ;
}
const name ='kanha';
index file - where you are importing the modules
filename = index.js
const op = require('./operator');
console.log(op.add(2,5));
console.log(op.sub(2,5));
console.log(op.name);
0 Comments
Post a Comment