摘要:
require 用来加载代码,而 exports 和 module.exports 则用来导出代码。但很多新手可能会迷惑于 exports 和 module.exports 的区别,为了更好的理解 exports 和 module.exports 的关系,我们先来巩固下 js 的基础。示例: tes 阅读全文
posted @ 2018-04-02 11:19
萧诺
阅读(165)
评论(0)
推荐(0)
摘要:
模块化的开发方式可以提高代码复用率,方便进行代码的管理。通常一个文件就是一个模块,有自己的作用域,只向外暴露特定的变量和函数。目前流行的js模块化规范有CommonJS、AMD、CMD以及ES6的模块系统。参见阮一峰老师的文章 module-loader 。 一、CommonJS Node.js是c 阅读全文
posted @ 2018-04-02 10:49
萧诺
阅读(179)
评论(0)
推荐(0)

浙公网安备 33010602011771号