I have the module...
var myModule = (function(){
var obj = new Object();
obj.name = "";
obj.sayName = function(){
obj.name = "jon";
console.log(obj.name);
console.log(this.name);
}
return obj;
})()
myModule.sayName();
This prints the word 'jon' twice as per the console.log statements.
However I don't really understand why 'this' is correct since it would return the reference to the function and be 'undefined' wouldn't it?