7

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)?

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
Novice coder
  • 79
  • 2
  • 7
  • Read here http://www.commonjs.org/specs/modules/1.0/ – elclanrs Jun 08 '13 at 04:10
  • `export` keyword details [here](https://developer.mozilla.org/en/docs/web/javascript/reference/statements/export). Currently it is not supported natively by any of the web-browsers. – RBT May 01 '17 at 06:43

1 Answers1

9

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...

Community
  • 1
  • 1
Software Engineer
  • 15,457
  • 7
  • 74
  • 102