js closure3
var closure = (function(){ var arr = [1, 3]; return { getA: (function() { return arr; }()), printArr: function() { console.log(arr); } }; }()); var firstGetArr = closure.getA; closure.printArr(); // [1, 3] firstGetArr[1] = 2; closure.printArr(); // [1, 2] var secondGetArr = closure.getA; closure.printArr(); // [1, 2]