I get a strange behaviour with Firefox when modifying a variable and displaying it (live demo here):
var MyModule = ( function() {
var currentPosition = {x : 1, y : 2, z : 3};
function changePosition() { currentPosition.x = 17; };
return { changePosition : changePosition,
currentPosition : currentPosition };
} )();
console.log(MyModule.currentPosition); // 17, 2, 3 instead of 1, 2, 3 !!
MyModule.changePosition();
console.log(MyModule.currentPosition); // 17, 2, 3
Why did this happen ? (Why does current.Position give 17 before it was modified to 17?)
More generally, how to get/set a variable in a Revealing Module Pattern?
Screenshot with Firefox:

I am going to guess that you ran the 3 lines one after each other and when you inspect the first printed line there is a little i next to it. Chrome will report the the most recent attributes of an object not the value of them at time of printing so if you were to just print the currentPosition and not run changePosition() then you would see 1,2,3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With