栗子:
module.exports.js
const greeting = name => {
return `hello ${name}!`
}
module.exports.greeting = greeting;
require.js
const a = require(‘./module.exports‘);
console.log(a.greeting(‘lvhanghmm‘))
node require.js
搞定!
【投稿说明】
博客园是面向开发者的知识分享社区,不允许发布任何推广、广告、政治方面的内容。
博客园首页(即网站首页)只能发布原创的、高质量的、能让读者从中学到东西的内容。
如果博文质量不符合首页要求,会被工作人员移出首页,望理解。如有疑问,请联系 contact@cnblogs.com。
NodeJS中模块成员导出的另一种方式![module.exports]
原文:https://www.cnblogs.com/lvhanghmm/p/15101355.html