+ 1

is it possible to make multiple export in single file node js?

3rd Sep 2020, 5:06 PM
Aayush $aini
Aayush $aini - avatar
2 Réponses
+ 2
es style export or cjs export ? both have their own way, but yes its possible
3rd Sep 2020, 5:08 PM
Rei
Rei - avatar
+ 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")
3rd Sep 2020, 6:45 PM
maf
maf - avatar