node.js exports module.exports

(make.js)
function
show(data){ console.log("WEILCOME" + data); } exports.show = show

获取

var show = require("./make").show;
show("jinkang");

输出   WELCOME jinkang

(make.js)
exports.show = function(data){ console.log("WEILCOME" + data); }
获取

var show = require("./make").show;
show("jinkang");

输出  WELCOME jinkang

 
(make.js)
module.exports = function(data){ console.log("WEILCOME" + data); }
获取

var show = require("./make");
show("jinkang");

输出 WELCOM jinkang

 

posted on 2017-08-19 10:43  思此狂  阅读(90)  评论(0编辑  收藏  举报

导航