Tuesday, 9 May 2017

Node - Using the function that is exported in the same file

I am trying to use the function that I am exporting in the same file, but I get undefined error:

 $(document).ready(function(){
     $.get('https://apiEndpoint.com)
        .done(function(data) {
          for (var key in data.subscriptionsInSet) {
            userSubscriptions.push(data.subscriptionsInSet[key].productName);
          }

          myFunction();

      });
  });

module.exports.myFunction = function() {
  console.log(userSubscriptions);
};

How can I use the function that I am exporting, in that same file?



via Leff

No comments:

Post a Comment