szhmqd21qxl
Version:
宇宙无敌屌爆了计算机
25 lines (20 loc) • 538 B
JavaScript
//定义函数
const add=(x,y)=>{
return x+y
}
const name = '小亮'
const age = 18
//导出的方式有以下几种
//方式一;如果我们知道只需要导出一个成员,就可以用方式一
// module.exports = add
// module.exports=name//这种方式后者覆盖前者
//方式二;把所有的成员合并成一个对象导出
// module.exports={
// add,
// name,
// age
// }
//方式二的扩展写法一
module.exports.name = name
module.exports.age = age
module.exports.add = add