so I'm going through a 'Modules' Chapter of Eloquent JS book and I've encountered a problem with the function(exports) part.
(function (exports) {
var names = ["Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"];
exports.name = function (number) {
return names[number];
};
exports.number = function (name) {
return names.indexOf(name);
};
})(this.weekDay = {});
console.log(weekDay.name(1));
returns
Cannot set property "weekDay" of undefined
However in the online editor on the book's website exactly the same code runs without problems and return "Monday".
I'm wondering if it's a problem with Adobe Brackets.