1. 程式人生 > >module.exports和export,對應require

module.exports和export,對應require

module.exports = {
    userName:'zhangdan',
    say:function () {
        return 'hello';
    }
}

exports.userName = "tom";
exports.say = function () {
    return "hello";
}

這兩種方式一樣,對應的是require

export和export default對應的import