[Help] iifc inside iifc returns undefined error

[Help] iifc inside iifc returns undefined error
0.0 0


iifc = Immediately invoked function constructor

I create an object (ShiftSwap) through an iifc and then create another public object (ShiftSwapUI) inside it it throguh an iifc.

When I refer to the second object (ShiftSwapUI), I get ShiftSwapUI has not been defined error.

But when I change the second object (ShiftSwapUI) from public (this.ShiftSwapUI) to private (var ShiftSwapUI) it works.


var ShiftSwap = new function()
	this.ShiftSwapUI = new function()
		var mainContainer;
		var mobileFilterContainer;
		var loginContainer;
		var shiftContainer;
		var loginMessage;
		var loginButton;
		this.InitializeUI = function()
			mainContainer = $('#js-main-container');
			mobileFilterContainer = $('#js-filter-container');
			loginContainer = $('#js-login-container');
			shiftContainer = $('#js-shift-container');
			loginMessage = $('#js-login-message');
			loginButton = $('#js-login-button');

	this.GeneralSetup  = function()
		this.ShiftSwapUI.InitializeUI(); //this.ShiftSwapUI is undefined error WHY!?
window.onload = ShiftSwap.GeneralSetup;