Javascript – Using “Exports.” in Javascript

exportfunctionjavascript

I'm a new coder and I'm trying to interpret exports in the following code:

exports.setCourse = function(c){
    course = c;
    Ti.API.debug('Setting course to ' + course.get('title'));
};

Whats the difference between exports.setCourse=function(c) and just setCourse=function (c)?

Best Solution

and welcome to the wonderful world of coding -- I hope you enjoy it.

exports is a node.js concept that declares the functions that your module makes available to code outside itself. It defines the module's interface.

Check out this StackOverflow answer...