Here are two reworkings:
Keeping the function2 label
Functions = {
function1: function() {
function2:
(function() {
alert('bam');
})();
}
};
Functions.function1(); // You still can't access the label function2 however
Removing the function2 label (switch for a return
Functions = {
function1: function() {
return function() {
alert('bam');
};
}
};
Functions.function1()();
Bottom line is that the code doesn't work as it stand because you cannot treat a label as if it was a property of a function.
The closest you could get (as far as I can tell) to calling function2 off of function1 is (without a return statement):
Functions = {
function1: function() {
}
};
Functions.function1.function2 = function() {
alert("bam");
};
Functions.function1.function2();