对exports 和 module.exports的理解

exports指向module.exports,不可重新赋值为新对象,只能添加属性及内部方法

exports.test = function(){
console.log(‘122’)
};
exports.name = ‘xss’;

module.exports = {
name: ‘xss’,
test: function(){
console.log(‘122’)
}
};

效果是一样的

猜你喜欢

转载自blog.csdn.net/xss392795158/article/details/89397524
今日推荐