Slide 5
Slide 5 text
Modules help us out!
function AsyncAttendee(name) {
this.name = name;
}
// Make the module a reference to the constructor.
module.exports = AsyncAttendee;
// "private" methods take context as the zeroth argument.
function sayHello(asyncAttendee) {
return 'Hello ' + asyncAttendee.name + '!';
}
AsyncAttendee.prototype.hello = function () {
console.log(sayHello(this));
};