require.js(amd)
异步请求模块(适用于浏览器)
//a.js
define(['jqurey'],function($){
return{};
})
//b.js
require(['./a.js'],function(xxx){
console.log(xxx);
})
common js
同步请求模块(适用于node.js)
//a.js
exports.name="zz";
exports.age=19;
//b.js
var xxx=require('./a.js');
console.log(xxx.name)
ES mdoule
抄袭common js
//a.js
let name="zz";
let age=19;
export name;
export age;
//b.js
import {name,age} from './b.js'