Struggling to access pubOuter and keep getting undefined. Can anyone help me with this issue? I can't seem to pass outer from the inner2() function. Maybe I'm overlooking something obvious. Thanks in advance.
Javascript
var myObject = (function(){
var outer;
function inner1(IN_number){
outer = IN_number*2;
}
function inner2(){
inner1(10);
return outer;
}
return {
pubFnInner1: inner1,
pubFnInner2: inner2,
pubOuter: outer
};
})();
$("#click").on("click", function(){
console.log("outer" + myObject.pubOuter);
});
HTML
<button id="click">Click</button>