+ 1
is it possible to make multiple export in single file node js?
2 ответов
+ 2
es style export or cjs export ?
both have their own way, but yes its possible
+ 4
Yes, its possible
Export an object that contains multiple things,
module.exports = {
sayHi: (name) => {
return "hi " + name
},
sayBye: (name) => {
return "bye " + name
},
salary: 5000
}
Now in the other file,
const { sayHi, sayBye, salary } = require("relative path to the file from which u wanna import")