详细讲解CommonJS与ES6模块化开发
1.CommonJS模块化开发
(1)创建工具类
//工具类
const sum = function(a,b){
return a+b;
}
const sub = function(a,b){
return a-b;
}
const mul = function(a,b){
return a*b;
}
const di = function(a,b){
return a/b;
}
// 导出给别人使用
module.exports = {
sum,
sub
原创
2021-11-10 23:51:31 ·
669 阅读 ·
0 评论