Answers for "module.exports vs exports"

1

module.exports vs exports

//module.exports used for object 
var log = {
            info: function (info) { 
                console.log('Info: ' + info);
            },
            warning:function (warning) { 
                console.log('Warning: ' + warning);
            },
            error:function (error) { 
                console.log('Error: ' + error);
            }
    };

module.exports = log

//exports used for function 

exports.SimpleMessage = 'Hello world';
Posted by: Guest on September-29-2020

Code answers related to "module.exports vs exports"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language