模块系统 show.js //自定义show模块 //定义show类 function show(){ this.name='user1'; this.say=function(){ console.log('my name is '+this.name); } } module.exports=new show(); 引入show.js const show = require('./show'); show.say(); console.log(show.name);