CommonJS根据JS的表现制定规范:
{模块引用(require)} {模块定义(exports)} {模块标识(module)}
NodeJS遵循了CommonJS规范,写法如下:
```js // foo.js
module.exports = function(x) { console.log(x); }; ```
```js // index.js
let foo = require('./foo') foo(1); ```
CommonJS主要为了JS在后 …
read moreThere are comments.